unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 54375@debbugs.gnu.org, Charles <charles.b.jackson@protonmail.com>
Subject: [bug#54375] Mutable guix shell environments
Date: Mon, 14 Mar 2022 23:18:35 +0100	[thread overview]
Message-ID: <87pmmop490.fsf_-_@gnu.org> (raw)
In-Reply-To: <6aaf3dfaa6c207b2968b756fa86806232227e2be.camel@telenet.be> (Maxime Devos's message of "Mon, 14 Mar 2022 18:54:52 +0100")

Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

> Charles via Guix-patches via schreef op zo 13-03-2022 om 18:21 [+0000]:
>> sample useage:
>> $ cd project
>> $ guix package --manifest=manifest.scm --profile=.guix-profile
>> $ guix shell # --profile=.guix-profile is implicit
>
> Alternative suggestion, which IMHO fits the non-persistent naturre of
> "guix shell" better:
>
> $ cd project
> $ guix shell --allow-temporary-modifications # fails on read-only file systems

Or ‘--transient’.

> $ echo $GUIX_ENVIRONMENT
> # a temporary (mutable) profile was created
>> $HOME/.cache/.../profile
> # install things in the $GUIX_ENVIRONMENT profile
> $ guix install foo bar ... 
>
> As noted by lilyp, this won't work in all situations due to search path
> issues.  These could be resolved by always setting a few search paths
> (PATH, EMACSLOADPATH, GUILE_LOAD_PATH, INFOPATH, ...) (even in not currently
> present in the profile!), at cost of having to make them ‘magical’ in some
> sense, which ludo does not seem to like IIUC.  (This could also be done
> for ~/.guix-profile)

I like this approach.

Charles’ proposal reminds me of ‘module’, a venerable “environment
management” tool widely used in high-performance computing (HPC):

  http://modules.sourceforge.net/

That command allows for an incremental style like Charles proposes:

  module load gcc      # adds GCC to $PATH
  module load libgc    # adds libgc to $C_INCLUDE_PATH
  module unload libgc  # removes libgc from $C_INCLUDE_PATH

For this to work though, ‘module’ is actually a shell function: that
lets it adjust environment variables here and now.

Anyway, I digress…

I thought about this other approach:

  1. ‘guix shell’ always builds a new profile, as it already does.

  2. When ‘GUIX_ENVIRONMENT’ is defined, it computes search paths as a
     combination of the new profile and that pointed to by
     $GUIX_ENVIRONMENT.

  3. It spawns a new shell, like it already does.

Thus, instead of doing upfront:

  guix shell a b c

One could do:

  $ guix shell a
  [env]$ guix shell b
  [env]$ guix shell c

It is more accurate but less flexible than what you propose though,
because only child processes of the nested shells would see the
“changes”.  So maybe not a good idea, after all.

Hmm, need more thought…

Thanks,
Ludo’.




  parent reply	other threads:[~2022-03-14 22:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-13 18:21 [bug#54375] Mutable guix shell environments Charles via Guix-patches via
2022-03-13 19:51 ` Liliana Marie Prikler
2022-03-13 23:38   ` Charles via Guix-patches via
2022-03-14  5:19     ` Liliana Marie Prikler
2022-03-14  6:24       ` Charles via Guix-patches via
2022-03-14 17:43 ` Maxime Devos
2022-03-14 17:54 ` Maxime Devos
2022-03-14 19:41   ` Charles via Guix-patches via
2022-03-14 22:18   ` Ludovic Courtès [this message]
2022-03-15  9:49     ` zimoun
2022-03-15 23:52       ` Charles via Guix-patches via

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=87pmmop490.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=54375@debbugs.gnu.org \
    --cc=charles.b.jackson@protonmail.com \
    --cc=maximedevos@telenet.be \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).