unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Phil <phil@beadling.co.uk>, help-guix@gnu.org
Subject: Re: Replacing python venv - environment or profile?
Date: Wed, 25 Nov 2020 23:00:42 +0100	[thread overview]
Message-ID: <86sg8xrt9x.fsf@gmail.com> (raw)
In-Reply-To: <858sapqjai.fsf@beadling.co.uk>

Hi,

On Wed, 25 Nov 2020 at 20:21, Phil <phil@beadling.co.uk> wrote:

> Yes this makes perfect sense to me, I guess what I was missing was that
> a 'guix environment' is just a temporary and special case of sourcing a
> Guix profile.

Yes, if you are curious by the internal machinery.  The default profile
~/.guix-profile is a symlink

  $ readlink -f ~/.guix-profile
  /gnu/store/z32aid8bjbz7ylwbjfh5x6lbg2g7fiv0-profile

Now compare:

  $ guix environment --ad-hoc hello
  [env]$ echo $GUIX_ENVIRONMENT
  /gnu/store/hgh67ilwsbx6v2irc7vgrnv354cv4h8a-profile

but no symlink points to the environment temporary profile, so once out,
the GC can do its job.

To end with the internals, give a look to the file:

  /gnu/store/…-profile/etc/profile

it describes how the environment variables are set.


>>   guix environment --ad-hoc python
>>   [..work..]
>>   guix pull
>>   guix environment --ad-hoc python
>>
>> Now, the first Python is not necessary the exact same than the second
>> one.  Considering the sequence,
>
> Yep you're creating two separate environments each taken from the
> current 'latest' python version.  Which may have been updated by guix
> pull for example.

Yes, exactly.


>>> $ guix environment --pure --manifest=manifest.scm --root=./test-profile
>>
>> I am not convinced you need the --root at first.
>
> This is purely a way of creating a pure environment from a manifest, and
> creating a profile from that same manifest as a one-liner (to pin the
> packages in the store).  If you'd previously created a profile with the
> same manifest this would be unnecessary.

Yes.  My point was to have at first an explanation about environment vs
profile, trying to avoid to mix all the concept in the same time. :-)


>> This create a environment, not a profile.  For a profile, you should do:
>>
>>   guix package -m manifest.scm -p ./test-profile
>
> Yep - so this does the same thing as the above, but doesn't then put me
> into a 'guix environment' referencing the same pacakges as the
> test-profile does.

I am not sure that understand what you mean.

  $ guix environment --pure --manifest=manifest.scm --root=./test-profile
<=>
  $ guix package -m manifest.scm -p ./test-profile
  $ eval $(guix package –search-paths=exact)

I almost never use the former, i.e., options -m and -r in the same
line.  And I prefer the latter.  Just a matter of taste.

However, I use “guix environment hello -r /tmp/guix”.  I let you notice
the difference. ;-)


> So, if I instantiate the environment using "--search-paths=exact" then I
> get *pure* environment variables, rather than appending or prepending to
> the current variables.

Yes, even if I do not know if “instantiate the environment” is the
correct terminology here. :-)


> So using this I don't need "guix environment --pure" anymore!  Which was
> what I wanted.

It depends.  Sometimes, you want to temporary extend a profile so “guix
environment” is really useful.  Or run in a container.  Or have all the
dependencies necessary of one package, for example:

  guix environment python-mypy --ad-hoc python-numpy


>> But if you want crazy isolation with container, you can do:
>>
>>   guix describe -f channels > my-channels.scm

Run

  guix help
  guix describe

and then the commit capture everything of Guix.  So at any point in
time, you can still run:

   guix time-machine –commit=123456 – help

and it will be the exact same code running “help” that the one running
now.  And any command works: install, environment, pack, system, etc.


>> then any point in time, you will have the exact same environment with:
>>
>>   guix time-machine -C my-channels -- environment -C -m my-manifest.scm
>
> This is snapshotting not just my manifest, but also the exact state of
> the Guix commands themselves - so the environment and the tooling for
> that environment are both replicated?

Yes.

In a repo, you have to track 2 things: the manifest.scm about the
packages you need **and** the channels.scm file which is the correct
description of their versions (and the versions of all the machinery
used to bootstrap, compile or byte-compile them).

This way, you can regenerate the exact same “environment” at any time
and any where, for example:

 guix time-machine -C my-channels -- pack -f docker -m my-manifest.scm


> Yes agreed - let's discuss later, I just wanted to give the group a
> vague idea of where I'm hopefully ultimately heading with my Guix use,
> but I must walk before I run!

Sound a cool goal!


All the best,
simon



  reply	other threads:[~2020-11-25 22:07 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 [this message]
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

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=86sg8xrt9x.fsf@gmail.com \
    --to=zimon.toutoune@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).