summaryrefslogtreecommitdiff
path: root/gnu/system.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.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.scm')
-rw-r--r--gnu/system.scm24
1 files changed, 7 insertions, 17 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 30f55967c43..06181606fa4 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1141,23 +1141,13 @@ for i in /etc/profile.d/*.sh; do
1141done 1141done
1142unset i 1142unset i
1143 1143
1144if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ] 1144if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]; then
1145then 1145 # Load Bash-specific initialization code, taking care to not source
1146 # Load Bash-specific initialization code. 1146 # /etc/bashrc when invoked from a non-interactive SSH shell,
1147 . /etc/bashrc 1147 # to avoid recursion (/etc/bashrc also sources /etc/profile
1148 # in the non-login, non-interactive SSH case).
1149 [[ $- != *i* && -n $SSH_CLIENT ]] || source /etc/bashrc
1148fi 1150fi
1149"))
1150
1151 (bashrc (plain-file "bashrc" "\
1152# Bash-specific initialization.
1153
1154# Provide a default prompt. The user's ~/.bashrc can override it.
1155PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
1156
1157for i in /etc/bashrc.d/*.sh; do
1158 [[ -r $i ]] && source \"$i\"
1159done
1160unset i
1161"))) 1151")))
1162 (service etc-service-type 1152 (service etc-service-type
1163 `(("os-release" ,os-release) 1153 `(("os-release" ,os-release)
@@ -1168,7 +1158,7 @@ unset i
1168 ("issue" ,issue) 1158 ("issue" ,issue)
1169 ,@(if nsswitch `(("nsswitch.conf" ,nsswitch)) '()) 1159 ,@(if nsswitch `(("nsswitch.conf" ,nsswitch)) '())
1170 ("profile" ,profile) 1160 ("profile" ,profile)
1171 ("bashrc" ,bashrc) 1161 ("bashrc" ,%default-bashrc)
1172 ;; Write the operating-system-host-name to /etc/hostname to prevent 1162 ;; Write the operating-system-host-name to /etc/hostname to prevent
1173 ;; NetworkManager from changing the system's hostname when connecting 1163 ;; NetworkManager from changing the system's hostname when connecting
1174 ;; to certain networks. Some discussion at 1164 ;; to certain networks. Some discussion at