summaryrefslogtreecommitdiff
path: root/gnu/home
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/home
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/home')
-rw-r--r--gnu/home/services/shells.scm14
1 files changed, 7 insertions, 7 deletions
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index bab5730c3d6..969a3eb8dcf 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -20,6 +20,7 @@
(define-module (gnu home services shells)
#:use-module (gnu services configuration)
+ #:use-module ((gnu services) #:select (%default-bash-aliases))
#:autoload (gnu system shadow) (%default-bashrc %default-zprofile)
#:use-module (gnu home services utils)
#:use-module (gnu home services)
@@ -333,9 +334,12 @@ another process for example)."))
(package bash)
"The Bash package to use.")
(guix-defaults?
+ ;; TODO: Set to #f when the target system is determined to be Guix System.
(boolean #t)
- "Add sane defaults like reading @file{/etc/bashrc} and coloring the output of
-@command{ls} to the top of the @file{.bashrc} file.")
+ "Add sane defaults like setting @env{PS1}, @env{SHELL}, and ensuring
+@file{/etc/profile} is sourced for non-interactive SSH shells. If you use
+Guix System, is it safe to set this to @code{#f}, as in this case this is
+already taken care of by the globally installed @file{/etc/bashrc}.")
(environment-variables
(alist '())
"Association list of environment variables to set for the Bash session. The
@@ -344,7 +348,7 @@ here (@pxref{Essential Home Services}). The contents of this field will be
added after the contents of the @code{bash-profile} field."
(serializer serialize-posix-env-vars))
(aliases
- (alist '())
+ (alist %default-bash-aliases)
"Association list of aliases to set for the Bash session. The aliases will be
defined after the contents of the @code{bashrc} field has been put in the
@file{.bashrc} file. The alias will automatically be quoted, so something line
@@ -423,10 +427,6 @@ if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
'bashrc
(if (home-bash-configuration-guix-defaults? config)
(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]}\\$ '\n"
(serialize-field 'aliases))
(list (serialize-field 'aliases))))
(file-if-not-empty 'bash-logout)))))