unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Phil <phil@beadling.co.uk>
Cc: help-guix@gnu.org
Subject: Re: Replacing python venv - environment or profile?
Date: Sun, 29 Nov 2020 15:34:34 -0500	[thread overview]
Message-ID: <871rgboqat.fsf@gmail.com> (raw)
In-Reply-To: <85r1oifz56.fsf@beadling.co.uk> (phil@beadling.co.uk's message of "Tue, 24 Nov 2020 17:22:29 +0000")

Hi Phil,

Phil <phil@beadling.co.uk> writes:

> Hi all,
>
> Apologies this is a bit longer than I anticipated, but I wanted to record
> all the steps I'd taken to explain my reasoning - in case it's wrong!
>
> I'm new the Guix and considering adopting it as an expansion to my
> current use of Python virtual environments in development and
> production, to include other non-Python packages too.
>
> The potential of the software is very exciting!
>
> I've read the manual/cookbook and I get the gist of the tool.  One thing
> I'm getting a bit stuck on is the appropriate use of environment vs
> profile; different sources give slightly different takes on the theme, and I
> want to make sure my use is correct from the get-go.

It seems you've done your homework :-).

> I'll be using Guix on a foreign OS, I suspect the answers might be
> slightly different if I was able to adopt the Guix System OS, but for
> now I can't.
>

[...]

> I'm keen to avoid accidentally calling anything in the foreign OS,
> something the 'guix environment' command gives me, but obviously the foreign
> OS will serve as a fallback given the above PATH construction under a sourced
> profile.  So if my profile doesn't have python installed, but it is part
> of the foreign OS, I would silently pick that up, which would be bad.
>
>
> As per 4.1.1 in the cookbook I can avoid setting other profiles using:
>
> $ env -i $(which bash) --login --noprofile --norc
> $ export GUIX_PROFILE=/home/ubuntu/dev/test-profile
> $ . $GUIX_PROFILE/etc/profile
>
> But the foreign OS variables remain:
>
> $ echo $PATH
> /home/ubuntu/dev/test-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> $ 

I could reproduce on a foreign distro but not on Guix System:

--8<---------------cut here---------------start------------->8---
$ env -i $(which bash) -c 'echo $PATH'
/no-such-path
--8<---------------cut here---------------end--------------->8---

It appears this is caused by the foreign Bash, which hard-codes a
default value for PATH
(/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin in your
case).

The Bash package on Guix (you can go to its definition using 'guix edit
bash') has the following compilation flags:

  (let* ((cppflags (string-join '("-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
                                  "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
                                  "-DNON_INTERACTIVE_LOGIN_SHELLS"
                                  "-DSSH_SOURCE_BASHRC")
                                " "))

This is where that non-existing (/no-such-path) value comes from.

As a workaround, you could use Bash from Guix after installing it with 'guix install bash'.

HTH!

Thanks,

Maxim


      parent reply	other threads:[~2020-11-29 20:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 17:22 Replacing python venv - environment or profile? Phil
2020-11-24 20:44 ` zimoun
2020-11-25 20:21   ` Phil
2020-11-25 22:00     ` zimoun
2020-11-24 23:34 ` Dr. Arne Babenhauserheide
2020-11-25 20:35   ` Phil
2020-11-25 14:37 ` Christopher Lam
2020-11-25 15:36   ` zimoun
2020-11-25 22:54     ` Christopher Lam
2020-11-25 23:09       ` zimoun
2020-11-29 20:34 ` Maxim Cournoyer [this message]

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=871rgboqat.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=phil@beadling.co.uk \
    /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).