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.
This commit is contained in:
parent
8173ceee1f
commit
201855221f
@ -5456,7 +5456,8 @@ details on Bash start-up files.}.
|
|||||||
|
|
||||||
@vindex GUIX_ENVIRONMENT
|
@vindex GUIX_ENVIRONMENT
|
||||||
@command{guix environment} defines the @code{GUIX_ENVIRONMENT}
|
@command{guix environment} defines the @code{GUIX_ENVIRONMENT}
|
||||||
variable in the shell it spawns. This allows users to, say, define a
|
variable in the shell it spawns; its value is the file name of the
|
||||||
|
profile of this environment. This allows users to, say, define a
|
||||||
specific prompt for development environments in their @file{.bashrc}
|
specific prompt for development environments in their @file{.bashrc}
|
||||||
(@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}):
|
(@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}):
|
||||||
|
|
||||||
@ -5467,6 +5468,13 @@ then
|
|||||||
fi
|
fi
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
... or to browse the profile:
|
||||||
|
|
||||||
|
@example
|
||||||
|
$ ls "$GUIX_ENVIRONMENT/bin"
|
||||||
|
@end example
|
||||||
|
|
||||||
Additionally, more than one package may be specified, in which case the
|
Additionally, more than one package may be specified, in which case the
|
||||||
union of the inputs for the given packages are used. For example, the
|
union of the inputs for the given packages are used. For example, the
|
||||||
command below spawns a shell where all of the dependencies of both Guile
|
command below spawns a shell where all of the dependencies of both Guile
|
||||||
|
@ -90,8 +90,9 @@ existing enviroment variables with additional search paths."
|
|||||||
(evaluate-profile-search-paths profile paths))
|
(evaluate-profile-search-paths profile paths))
|
||||||
|
|
||||||
;; Give users a way to know that they're in 'guix environment', so they can
|
;; Give users a way to know that they're in 'guix environment', so they can
|
||||||
;; adjust 'PS1' accordingly, for instance.
|
;; adjust 'PS1' accordingly, for instance. Set it to PROFILE so users can
|
||||||
(setenv "GUIX_ENVIRONMENT" "t"))
|
;; conveniently access its contents.
|
||||||
|
(setenv "GUIX_ENVIRONMENT" profile))
|
||||||
|
|
||||||
(define (show-search-paths profile search-paths pure?)
|
(define (show-search-paths profile search-paths pure?)
|
||||||
"Display SEARCH-PATHS applied to PROFILE. When PURE? is #t, do not augment
|
"Display SEARCH-PATHS applied to PROFILE. When PURE? is #t, do not augment
|
||||||
|
@ -57,6 +57,10 @@ else
|
|||||||
test $? = 42
|
test $? = 42
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure 'GUIX_ENVIRONMENT' points to the profile.
|
||||||
|
guix environment --bootstrap --ad-hoc guile-bootstrap --pure \
|
||||||
|
-- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
|
||||||
|
|
||||||
case "`uname -m`" in
|
case "`uname -m`" in
|
||||||
x86_64)
|
x86_64)
|
||||||
# On x86_64, we should be able to create a 32-bit environment.
|
# On x86_64, we should be able to create a 32-bit environment.
|
||||||
|
Loading…
Reference in New Issue
Block a user