diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-07-26 17:59:25 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-07-26 17:59:25 +0200 |
| commit | 201855221fa426851556b973e39f21e5ced7dfdf (patch) | |
| tree | 3d64746996442dba5ac31112c5d34ce841d28eaf | |
| parent | 8173ceee1f31ab562118ff5171254a4b73b71400 (diff) | |
environment: Set 'GUIX_ENVIRONMENT' to the profile.
* guix/scripts/environment.scm (create-environment): Set
'GUIX_ENVIRONMENT' to PROFILE.
* tests/guix-environment.sh: Test it.
* doc/guix.texi (Invoking guix environment): Document it.
| -rw-r--r-- | doc/guix.texi | 10 | ||||
| -rw-r--r-- | guix/scripts/environment.scm | 5 | ||||
| -rw-r--r-- | tests/guix-environment.sh | 4 |
3 files changed, 16 insertions, 3 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 8ab45221405..786fe551ba6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -5456,7 +5456,8 @@ details on Bash start-up files.}. | |||
| 5456 | 5456 | ||
| 5457 | @vindex GUIX_ENVIRONMENT | 5457 | @vindex GUIX_ENVIRONMENT |
| 5458 | @command{guix environment} defines the @code{GUIX_ENVIRONMENT} | 5458 | @command{guix environment} defines the @code{GUIX_ENVIRONMENT} |
| 5459 | variable in the shell it spawns. This allows users to, say, define a | 5459 | variable in the shell it spawns; its value is the file name of the |
| 5460 | profile of this environment. This allows users to, say, define a | ||
| 5460 | specific prompt for development environments in their @file{.bashrc} | 5461 | specific prompt for development environments in their @file{.bashrc} |
| 5461 | (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}): | 5462 | (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}): |
| 5462 | 5463 | ||
| @@ -5467,6 +5468,13 @@ then | |||
| 5467 | fi | 5468 | fi |
| 5468 | @end example | 5469 | @end example |
| 5469 | 5470 | ||
| 5471 | @noindent | ||
| 5472 | ... or to browse the profile: | ||
| 5473 | |||
| 5474 | @example | ||
| 5475 | $ ls "$GUIX_ENVIRONMENT/bin" | ||
| 5476 | @end example | ||
| 5477 | |||
| 5470 | Additionally, more than one package may be specified, in which case the | 5478 | Additionally, more than one package may be specified, in which case the |
| 5471 | union of the inputs for the given packages are used. For example, the | 5479 | union of the inputs for the given packages are used. For example, the |
| 5472 | command below spawns a shell where all of the dependencies of both Guile | 5480 | command below spawns a shell where all of the dependencies of both Guile |
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index ebe966f9cf5..9f72b7bf241 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm | |||
| @@ -90,8 +90,9 @@ existing enviroment variables with additional search paths." | |||
| 90 | (evaluate-profile-search-paths profile paths)) | 90 | (evaluate-profile-search-paths profile paths)) |
| 91 | 91 | ||
| 92 | ;; Give users a way to know that they're in 'guix environment', so they can | 92 | ;; Give users a way to know that they're in 'guix environment', so they can |
| 93 | ;; adjust 'PS1' accordingly, for instance. | 93 | ;; adjust 'PS1' accordingly, for instance. Set it to PROFILE so users can |
| 94 | (setenv "GUIX_ENVIRONMENT" "t")) | 94 | ;; conveniently access its contents. |
| 95 | (setenv "GUIX_ENVIRONMENT" profile)) | ||
| 95 | 96 | ||
| 96 | (define (show-search-paths profile search-paths pure?) | 97 | (define (show-search-paths profile search-paths pure?) |
| 97 | "Display SEARCH-PATHS applied to PROFILE. When PURE? is #t, do not augment | 98 | "Display SEARCH-PATHS applied to PROFILE. When PURE? is #t, do not augment |
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh index 0b5123ab45b..68343520b07 100644 --- a/tests/guix-environment.sh +++ b/tests/guix-environment.sh | |||
| @@ -57,6 +57,10 @@ else | |||
| 57 | test $? = 42 | 57 | test $? = 42 |
| 58 | fi | 58 | fi |
| 59 | 59 | ||
| 60 | # Make sure 'GUIX_ENVIRONMENT' points to the profile. | ||
| 61 | guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ | ||
| 62 | -- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"' | ||
| 63 | |||
| 60 | case "`uname -m`" in | 64 | case "`uname -m`" in |
| 61 | x86_64) | 65 | x86_64) |
| 62 | # On x86_64, we should be able to create a 32-bit environment. | 66 | # On x86_64, we should be able to create a 32-bit environment. |
