From 07ec349229eeae9f733fe92a300c7cfa4cf8e321 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 25 Jan 2018 22:29:15 -0500 Subject: environment: Add --link-profile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is motivated by attempts to run programs (like GNU IceCat) within containers. The 'fontconfig' program, for example, is configured explicitly to check ~/.guix-profile for additional fonts. There were no existing container tests in 'tests/guix-environment.sh', but I added one anyway for this change. * doc/guix.texi (Invoking guix environment): Add '--link-profile'. * guix/scripts/environment.scm (show-help): Add '--link-profile'. (%options): Add 'link-profile' as '#\P', assigned to 'link-profile?'. (link-environment): New procedure. (launch-environment/container): Use it when 'link-profile?'. [link-profile?]: New parameter. (guix-environment): Leave when '--link-prof' but not '--container'. Add '#:link-profile?' argument to 'launch-environment/container' application. * tests/guix-environment-container.sh: New '--link-profile' test. Signed-off-by: Ludovic Courtès --- tests/guix-environment-container.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/guix-environment-container.sh') diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index d7c1b7057e..df40ce03e0 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -97,6 +97,20 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash rm $tmpdir/mounts +# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested +# within a container. +( + linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT") +(readlink (string-append (getenv "HOME") "/.guix-profile"))))' + + cd "$tmpdir" \ + && guix environment --bootstrap --container --link-profile \ + --ad-hoc guile-bootstrap --pure \ + -- guile -c "$linktest" +) + +# Check the exit code. + abnormal_exit_code=" (use-modules (system foreign)) ;; Purposely make Guile crash with a segfault. :) -- cgit v1.2.3