mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-26 04:29:25 -05:00
environment: Define 'GUIX_ENVIRONMENT'.
* guix/scripts/environment.scm (create-environment): Define 'GUIX_ENVIRONMENT'. * doc/guix.texi (Invoking guix environment): Document it. * gnu/system/shadow.scm (default-skeletons): Adjust 'PS1' depending on whether 'GUIX_ENVIRONMENT' is defined.
This commit is contained in:
parent
50500f7cf0
commit
28de8d258b
3 changed files with 25 additions and 2 deletions
|
@ -4146,6 +4146,19 @@ variables in @file{.bashrc}; instead, they should be defined in
|
||||||
@xref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}, for
|
@xref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}, for
|
||||||
details on Bash start-up files.}.
|
details on Bash start-up files.}.
|
||||||
|
|
||||||
|
@vindex GUIX_ENVIRONMENT
|
||||||
|
@command{guix environment} defines the @code{GUIX_ENVIRONMENT}
|
||||||
|
variable in the shell it spaws. This allows users to, say, define a
|
||||||
|
specific prompt for development environments in their @file{.bashrc}
|
||||||
|
(@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}):
|
||||||
|
|
||||||
|
@example
|
||||||
|
if [ -n "$GUIX_ENVIRONMENT" ]
|
||||||
|
then
|
||||||
|
export PS1="\u@@\h \w [dev]\$ "
|
||||||
|
fi
|
||||||
|
@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
|
||||||
|
|
|
@ -153,7 +153,13 @@ (define copy-guile-wm
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PS1='\\u@\\h \\w\\$ '
|
# Adjust the prompt depending on whether we're in 'guix environment'.
|
||||||
|
if [ -n \"$GUIX_ENVIRONMENT\" ]
|
||||||
|
then
|
||||||
|
export PS1='\\u@\\h \\w\\ [env]$ '
|
||||||
|
else
|
||||||
|
export PS1='\\u@\\h \\w\\$ '
|
||||||
|
fi
|
||||||
alias ls='ls -p --color'
|
alias ls='ls -p --color'
|
||||||
alias ll='ls -l'\n"))
|
alias ll='ls -l'\n"))
|
||||||
(zlogin (text-file "zlogin" "\
|
(zlogin (text-file "zlogin" "\
|
||||||
|
|
|
@ -78,7 +78,11 @@ (define (create-environment inputs paths pure?)
|
||||||
(if (and current (not pure?))
|
(if (and current (not pure?))
|
||||||
(string-append value separator current)
|
(string-append value separator current)
|
||||||
value)))))
|
value)))))
|
||||||
(evaluate-input-search-paths inputs paths)))
|
(evaluate-input-search-paths inputs paths))
|
||||||
|
|
||||||
|
;; Give users a way to know that they're in 'guix environment', so they can
|
||||||
|
;; adjust 'PS1' accordingly, for instance.
|
||||||
|
(setenv "GUIX_ENVIRONMENT" "t"))
|
||||||
|
|
||||||
(define (show-search-paths inputs search-paths pure?)
|
(define (show-search-paths inputs search-paths pure?)
|
||||||
"Display SEARCH-PATHS applied to the packages specified by INPUTS, a list of
|
"Display SEARCH-PATHS applied to the packages specified by INPUTS, a list of
|
||||||
|
|
Loading…
Reference in a new issue