[PATCH] home: services: bash: Move default PS1 prompt to bashrc

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Richard Sent
Owner
unassigned
Submitted by
Richard Sent
Severity
normal
R
R
Richard Sent wrote on 5 Apr 00:53 +0200
(address . guix-patches@gnu.org)(name . Richard Sent)(address . richard@freakingpenguin.com)
c22ff49a18ad2323e4cf4a7fa6b25d006b50e03a.1712271207.git.richard@freakingpenguin.com

* home/services/shells.scm (add-bash-configuration): Move default PS1 prompt
from .bash_profile to .bashrc.

Change-Id: Ic437458ee362cc4aa803a71c9962af866749f59a
---
Hi Guix!

See the issue mentioned in the commit message for the motivation for
this patch.

gnu/home/services/shells.scm | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 8fd1668b59..a5b2586dde 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -415,14 +415,6 @@ (define (add-bash-configuration config)
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)))
@@ -430,6 +422,10 @@ (define (add-bash-configuration config)
'bashrc
(if (home-bash-configuration-guix-defaults? config)
(list (plain-file-content %default-bashrc)
+ ;; The host distro might provide a bad 'PS1'
+ ;; default--e.g., not taking $GUIX_ENVIRONMENT into
+ ;; account. Provide a good default here when asked.
+ "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '"
(serialize-field 'aliases))
(list (serialize-field 'aliases))))
(file-if-not-empty 'bash-logout)))))

base-commit: ade6845da6cec99f3bca46faac9b2bad6877817e
--
2.41.0
L
L
Ludovic Courtès wrote on 29 Apr 23:53 +0200
(name . Richard Sent)(address . richard@freakingpenguin.com)
87mspbzvgt.fsf@gnu.org
Hi Richard,

Richard Sent <richard@freakingpenguin.com> skribis:

Toggle quote (7 lines)
>
> * home/services/shells.scm (add-bash-configuration): Move default PS1 prompt
> from .bash_profile to .bashrc.
>
> Change-Id: Ic437458ee362cc4aa803a71c9962af866749f59a

Sounds reasonable to me; thanks for the clear explanation in

There was one missing newline before aliases so I made the following
change (adding two newlines, for good measure).

Applied, thanks!

Ludo’.
Toggle diff (18 lines)
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index a5b2586dde..ee6b09f17c 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -421,11 +421,11 @@ (define (add-bash-configuration config)
,@(list (file-if-not-empty
'bashrc
(if (home-bash-configuration-guix-defaults? config)
- (list (plain-file-content %default-bashrc)
+ (list (plain-file-content %default-bashrc) "\n"
;; The host distro might provide a bad 'PS1'
;; default--e.g., not taking $GUIX_ENVIRONMENT into
;; account. Provide a good default here when asked.
- "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '"
+ "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '\n"
(serialize-field 'aliases))
(list (serialize-field 'aliases))))
(file-if-not-empty 'bash-logout)))))
Closed
?