help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I replace Python venv and pip with Guix?


From: Ricardo Wurmus
Subject: Re: How can I replace Python venv and pip with Guix?
Date: Tue, 04 Feb 2020 15:02:36 +0100
User-agent: mu4e 1.2.0; emacs 26.3

sirgazil <address@hidden> writes:

> • Once I deactivate this environment (Ctrl+D), how can I activate it again?

It’s a matter of evaluating the etc/profile file that is generated for
every Guix profile.  Since you passed

    --root=/path/to/my-guix-envs/my-project

to “guix environment” there will be a file

    /path/to/my-guix-envs/my-project/etc/profile

You can set all the environment variables it defines with

    GUIX_PROFILE=/path/to/my-guix-envs/my-project
    source $GUIX_PROFILE/etc/profile

If you want a pure environment you can use “env”.  On our HPC cluster I
provide “activate” scripts like this one:

--8<---------------cut here---------------start------------->8---
#!/bin/bash

profile=/path/to/.guix-profile
prompt='\u@\h:\W \[\e[31;47;1m\][pigx]\[\e[m\] $ '

REAL_HOME=$HOME
exec /bin/env - PS1="$prompt" \
                HOME=$REAL_HOME \
                LANG=en_US.UTF-8 \
                GUIX_LOCPATH="$profile/lib/locale" \
                CURL_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt" \
                /bin/bash --init-file "$profile/etc/profile"
--8<---------------cut here---------------end--------------->8---

It sets a few environment variables, recovers some variables that are
important, and then starts a sub-shell that uses the generated
etc/profile file as its init file.

Something like that might work for you.

--
Ricardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]