mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 13:28:12 -05:00
system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc.
Users can override 'PS1' in ~/.bashrc if they wish. Previously, on Guix Home, the "default" 'PS1' would be set in ~/.bashrc when 'home-bash-configuration-guix-defaults?' is true, preventing users from overriding it via the 'environment-variables' field of 'home-bash-extension'. * gnu/system/shadow.scm (%default-bashrc): Remove 'PS1' setting. * gnu/system.scm (operating-system-etc-service): Define PS1 in /etc/bashrc. * gnu/home/services/shells.scm (add-bash-configuration): When 'home-bash-configuration-guix-defaults?' is true, add a default 'PS1' to ~/.bash_profile.
This commit is contained in:
parent
2127e56bd8
commit
086df6ef21
3 changed files with 12 additions and 7 deletions
|
@ -407,6 +407,15 @@ (define* (file-if-not-empty field #:optional (extra-content #f))
|
|||
# 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)))
|
||||
|
||||
|
|
|
@ -1047,6 +1047,9 @@ (define* (operating-system-etc-service os)
|
|||
(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
|
||||
|
|
|
@ -142,13 +142,6 @@ (define %default-bashrc
|
|||
# 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"))
|
||||
|
|
Loading…
Reference in a new issue