GNU bug report logs -
#43408
[PATCH] environment: '--link-profile' uses ~/.guix-profile for environment variables.
Previous Next
Reported by: Ludovic Courtès <ludo <at> gnu.org>
Date: Mon, 14 Sep 2020 20:54:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43408 in the body.
You can then email your comments to 43408 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#43408
; Package
guix-patches
.
(Mon, 14 Sep 2020 20:54:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 14 Sep 2020 20:54:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Before this patch, we had:
$ guix environment -CP --ad-hoc coreutils
[env]$ echo $PATH
/gnu/store/…-profile/bin
[env]$ echo $GUIX_ENVIRONMENT
/gnu/store/…-profile
After this patch:
$ guix environment -CP --ad-hoc coreutils
[env]$ echo $PATH
/home/ludo/.guix-profile/bin
[env]$ echo $GUIX_ENVIRONMENT
/home/ludo/.guix-profile
* guix/scripts/environment.scm (launch-environment/container): When
LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to
'launch-environment'.
* tests/guix-environment-container.sh: Adjust test accordingly.
* doc/guix.texi (Invoking guix environment): Update accordingly.
---
doc/guix.texi | 5 +++--
guix/scripts/environment.scm | 6 +++++-
tests/guix-environment-container.sh | 10 +++++++---
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5e4bfd8e85..e4650b2311 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5420,8 +5420,9 @@ device.
@item --link-profile
@itemx -P
For containers, link the environment profile to @file{~/.guix-profile}
-within the container. This is equivalent to running the command
-@samp{ln -s $GUIX_ENVIRONMENT ~/.guix-profile} within the container.
+within the container and set @code{GUIX_ENVIRONMENT} to that.
+This is equivalent to making @file{~/.guix-profile} a symlink to the
+actual profile within the container.
Linking will fail and abort the environment if the directory already
exists, which will certainly be the case if @command{guix environment}
was invoked in the user's home directory.
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index ad50281eb2..e2e481dd02 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -564,7 +564,11 @@ WHILE-LIST."
(primitive-exit/status
;; A container's environment is already purified, so no need to
;; request it be purified again.
- (launch-environment command profile manifest #:pure? #f)))
+ (launch-environment command
+ (if link-profile?
+ (string-append home-dir "/.guix-profile")
+ profile)
+ manifest #:pure? #f)))
#:guest-uid uid
#:guest-gid gid
#:namespaces (if network?
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh
index 45264d4978..040f32cce9 100644
--- a/tests/guix-environment-container.sh
+++ b/tests/guix-environment-container.sh
@@ -127,11 +127,15 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash
rm $tmpdir/mounts
-# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested
+# Make sure 'GUIX_ENVIRONMENT' is set to '~/.guix-profile' when requested
# within a container.
(
- linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT")
-(readlink (string-append (getenv "HOME") "/.guix-profile"))))'
+ linktest='
+(exit (and (string=? (getenv "GUIX_ENVIRONMENT")
+ (string-append (getenv "HOME") "/.guix-profile"))
+ (string-prefix? "'"$NIX_STORE_DIR"'"
+ (readlink (string-append (getenv "HOME")
+ "/.guix-profile")))))'
cd "$tmpdir" \
&& guix environment --bootstrap --container --link-profile \
--
2.28.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Mon, 21 Sep 2020 21:39:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
bug acknowledged by developer.
(Mon, 21 Sep 2020 21:39:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 43408-done <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès <ludo <at> gnu.org> skribis:
> Before this patch, we had:
>
> $ guix environment -CP --ad-hoc coreutils
> [env]$ echo $PATH
> /gnu/store/…-profile/bin
> [env]$ echo $GUIX_ENVIRONMENT
> /gnu/store/…-profile
>
> After this patch:
>
> $ guix environment -CP --ad-hoc coreutils
> [env]$ echo $PATH
> /home/ludo/.guix-profile/bin
> [env]$ echo $GUIX_ENVIRONMENT
> /home/ludo/.guix-profile
>
> * guix/scripts/environment.scm (launch-environment/container): When
> LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to
> 'launch-environment'.
> * tests/guix-environment-container.sh: Adjust test accordingly.
> * doc/guix.texi (Invoking guix environment): Update accordingly.
Pushed as 9b65281de51bcb56714509524f5ae0731c9b96d0.
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 20 Oct 2020 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.