summary refs log tree commit diff
path: root/tests/guix-environment-container.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-09-14 22:49:06 +0200
committerLudovic Courtès <ludo@gnu.org>2020-09-21 23:05:38 +0200
commit9b65281de51bcb56714509524f5ae0731c9b96d0 (patch)
treeffbbdf71c7e41a134a4e3bbfbce1a752ea7231be /tests/guix-environment-container.sh
parenta2b25890ee37c017bc77a6b923577f258fa3fba0 (diff)
downloadguix-9b65281de51bcb56714509524f5ae0731c9b96d0.tar.gz
environment: '--link-profile' uses ~/.guix-profile for environment variables.
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.
Diffstat (limited to 'tests/guix-environment-container.sh')
-rw-r--r--tests/guix-environment-container.sh10
1 files changed, 7 insertions, 3 deletions
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 \