summaryrefslogtreecommitdiff
path: root/guix/scripts/environment.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2023-01-08 19:32:17 +0100
committerMarius Bakke <marius@gnu.org>2023-01-08 19:32:17 +0100
commitda91e790fdf4053a1503738e69f88c4b2054b096 (patch)
tree27f26ac3308eaa34952314a3182ffce2f5dcd51e /guix/scripts/environment.scm
parent9123bb0fba3fce976dc41cd3b8919ee73b4cee4d (diff)
parent8cca1a35bc42cddb7e0586062d192197520042d5 (diff)
Merge branch 'master' into staging
Diffstat (limited to 'guix/scripts/environment.scm')
-rw-r--r--guix/scripts/environment.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index ab11b35335..c7fd8fd340 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -601,7 +601,12 @@ environment~%")))
(match (vhash-assoc "PS1" actual)
(#f #f)
((_ . str)
- (when (and (getenv "PS1") (string=? str (getenv "PS1")))
+ (when (and (getenv "PS1") (string=? str (getenv "PS1"))
+
+ ;; 'PS1' might be conditional on 'GUIX_ENVIRONMENT', as
+ ;; shown in the hint below.
+ (not (or (string-contains str "$GUIX_ENVIRONMENT")
+ (string-contains str "${GUIX_ENVIRONMENT"))))
(warning (G_ "'PS1' is the same in sub-shell~%"))
(display-hint (G_ "Consider setting a different prompt for
environment shells to make them distinguishable.
@@ -610,10 +615,7 @@ If you are using Bash, you can do that by adding these lines to
@file{~/.bashrc}:
@example
-if [ -n \"$GUIX_ENVIRONMENT\" ]
-then
- export PS1=\"\\u@@\\h \\w [env]\\$ \"
-fi
+PS1='\\u@@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
@end example
"))))))