diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index d7dd579293..3326eb37f4 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -407,6 +407,15 @@ if [ -f ~/.profile ]; then source ~/.profile; fi # Honor per-interactive-shell startup file if [ -f ~/.bashrc ]; then source ~/.bashrc; fi " + + ;; The host distro might provide a bad 'PS1' default--e.g., not taking + ;; $GUIX_ENVIRONMENT into account. Provide a good default here when + ;; asked to. The default can be overridden below via + ;; 'environment-variables'. + (if (home-bash-configuration-guix-defaults? config) + "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '\n" + "") + (serialize-field 'bash-profile) (serialize-field 'environment-variables))) diff --git a/gnu/system.scm b/gnu/system.scm index 62c8e0c2b6..d67f9a615b 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1047,6 +1047,9 @@ fi (bashrc (plain-file "bashrc" "\ # Bash-specific initialization. +# Provide a default prompt. The user's ~/.bashrc can override it. +PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' + # The 'bash-completion' package. if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ] then diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 4360a5ebd1..2e87928368 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -142,13 +142,6 @@ fi # Source the system-wide file. [ -f /etc/bashrc ] && source /etc/bashrc -# Adjust the prompt depending on whether we're in 'guix environment'. -if [ -n \"$GUIX_ENVIRONMENT\" ] -then - PS1='\\u@\\h \\w [env]\\$ ' -else - PS1='\\u@\\h \\w\\$ ' -fi alias ls='ls -p --color=auto' alias ll='ls -l' alias grep='grep --color=auto'\n"))