unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: sirgazil <sirgazil@zoho.com>
Cc: help-guix@gnu.org
Subject: Re: How can I replace Python venv and pip with Guix?
Date: Tue, 04 Feb 2020 15:02:36 +0100	[thread overview]
Message-ID: <87y2tiqwlf.fsf@elephly.net> (raw)
In-Reply-To: <170082257a9.bbf196a73697.871070894081541659@zoho.com>


sirgazil <sirgazil@zoho.com> 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

  parent reply	other threads:[~2020-02-04 14:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02 23:00 How can I replace Python venv and pip with Guix? sirgazil
2020-02-04  7:36 ` Moritz Lell
2020-02-04 13:00   ` sirgazil
2020-02-04 14:31     ` mlell
2020-02-04 18:09       ` sirgazil
2020-02-04  7:59 ` Tanguy Le Carrour
2020-02-04 14:26   ` sirgazil
2020-02-04 14:02 ` Ricardo Wurmus [this message]
2020-02-04 18:13   ` sirgazil
     [not found] <mailman.91.1580749212.18219.help-guix@gnu.org>
2020-02-03 21:09 ` Zelphir Kaltstahl
2020-02-03 22:56   ` sirgazil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2tiqwlf.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=help-guix@gnu.org \
    --cc=sirgazil@zoho.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).