From 086df6ef213d44d4b75c263033552eef6b2bd868 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 27 Dec 2022 21:52:59 +0100 Subject: 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. --- gnu/home/services/shells.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gnu/home/services') 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))) -- cgit v1.2.3