summaryrefslogtreecommitdiff
path: root/gnu/system/shadow.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-08 11:03:35 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-26 13:43:03 +0900
commitc743d646ee9104aa14d066cdf6657a0fac82ebea (patch)
tree0cbd78ae16fbbbfec8344b031f7f10dce407a571 /gnu/system/shadow.scm
parent45b883a9d33ff3bfd0bdb9c9eeea4d64eb73e10c (diff)
system: Factorize bashrc default configuration.
This factorizes out the remaining bashrc bits from /etc/skel/.bashrc to a the template used for both /etc/bashrc on Guix System and ~/.bashrc for home-bash-service-type. Rationale: The use of /etc/skel introduce state: the file is only copied originally when the user account is created, and never (automatically) refreshed again. * gnu/system.scm (operating-system-etc-service): <profile>: Guard against souring /etc/bashrc in non-interactive, SSH case. <bashrc>: Use %default-bashrc, having migrated the remaining definitions to... * gnu/system/shadow.scm (%default-bashrc): ... here. Factorize aliases to... * gnu/services.scm (%default-bash-aliases): ... here. (%default-bashrc-d-aliases): New variable. (%default-etc-bashrc-d-files): Include it in the default configuration. * gnu/services/base.scm (%base-services): Register etc-bashrc-d-service-type. * gnu/home/services/shells.scm (add-bash-configuration): Do not set PS1, now part of %default-bashrc. (home-bash-configuration) [guix-defaults?]: Update doc. [aliases]: Set %default-bash-aliases as the default value. Update doc. * doc/guix.texi (Shells Home Services): Update documentation. (Service Reference): Update example. Change-Id: I340c614983a78fd20a9c4a9705e7fc542ae9b513
Diffstat (limited to 'gnu/system/shadow.scm')
-rw-r--r--gnu/system/shadow.scm18
1 files changed, 10 insertions, 8 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index b9a5a6134b..6443fd9922 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -147,8 +147,11 @@
(define %default-bashrc
(plain-file "bashrc" "\
-# Bash initialization for interactive non-login shells and
-# for remote shells (info \"(bash) Bash Startup Files\").
+# Bash-specific initialization, including for non-login and remote
+# shells (info \"(bash) Bash Startup Files\").
+
+# Provide a default prompt.
+PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
# Export 'SHELL' to child processes. Programs such as 'screen'
# honor it and otherwise use /bin/sh.
@@ -165,10 +168,11 @@ then
return
fi
-alias ls='ls -p --color=auto'
-alias ll='ls -l'
-alias grep='grep --color=auto'
-alias ip='ip -color=auto'\n"))
+for i in /etc/bashrc.d/*.sh; do
+ [[ -r $i ]] && source \"$i\"
+done
+unset i
+"))
(define %default-bash-profile
(plain-file "bash_profile" "\
@@ -289,12 +293,10 @@ home-config"))
'useradd' in the home directory of newly created user accounts."
(let ((profile %default-bash-profile)
- (bashrc %default-bashrc)
(zprofile %default-zprofile)
(xdefaults %default-xdefaults)
(gdbinit %default-gdbinit))
`((".bash_profile" ,profile)
- (".bashrc" ,bashrc)
;; Zsh sources ~/.zprofile before ~/.zshrc, and it sources ~/.zlogin
;; after ~/.zshrc. To avoid interfering with any customizations a user
;; may have made in their ~/.zshrc, put this in .zprofile, not .zlogin.