1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-10 08:30:39 +02:00

system: Migrate sourcing bash_completion.sh to etc-bashrc-d-service-type.

* gnu/system.scm (operating-system-etc-service): Remove block sourcing
bash_completion.sh.
(%base-packages-interactive): Delete bash-completion.
* gnu/services.scm (%default-etc-bashrc-d-files): New variable, which includes
the bash_completion.sh file.
(etc-bashrc-d-service-type): Use it.
* doc/guix.texi (Service Reference): Update documentation.

Change-Id: I2223a5f96f5d761148badc6be29e1c5c80465a1d
This commit is contained in:
Maxim Cournoyer 2025-05-08 09:15:33 +09:00
parent 4c017ccfe5
commit 45b883a9d3
No known key found for this signature in database
GPG key ID: 1260E46482E63562
3 changed files with 12 additions and 14 deletions

View file

@ -47685,9 +47685,11 @@ create files under @file{/etc/bashrc.d}. It takes as value a list of
file-like objects, as can be produced with @code{local-file}, file-like objects, as can be produced with @code{local-file},
@code{plain-file}, etc. Note that provided files whose file names do @code{plain-file}, etc. Note that provided files whose file names do
not end with @file{.sh} are @emph{not} added to @file{/etc/profile.d/} not end with @file{.sh} are @emph{not} added to @file{/etc/profile.d/}
and are silently dropped. Package objects can also be provided directly and are silently dropped. The default value is made available via the
to have their @file{etc/bashrc.d/*.sh} prefixed files added. An example @var{%default-etc-bashrc-d-files} variable for users to extended.
usage may look like: Package objects can also be provided directly to have their
@file{etc/bashrc.d/*.sh} prefixed files added. An example usage may
look like:
@example @example
(use-package-modules gnome) ;for the `vte' package (use-package-modules gnome) ;for the `vte' package

View file

@ -124,6 +124,7 @@
etc-service-type etc-service-type
etc-profile-d-service-type etc-profile-d-service-type
etc-bashrc-d-service-type etc-bashrc-d-service-type
%default-etc-bashrc-d-files
etc-directory etc-directory
privileged-program-service-type privileged-program-service-type
setuid-program-service-type ; deprecated setuid-program-service-type ; deprecated
@ -992,6 +993,10 @@ log in.")))
(define files->bashrc-d-directory (define files->bashrc-d-directory
(make-files->etc-directory "bashrc.d")) (make-files->etc-directory "bashrc.d"))
(define %default-etc-bashrc-d-files
(list (file-append bash-completion
"/etc/profile.d/bash_completion.sh")))
(define etc-bashrc-d-service-type (define etc-bashrc-d-service-type
(service-type (service-type
(inherit etc-profile-d-service-type) (inherit etc-profile-d-service-type)
@ -1000,7 +1005,8 @@ log in.")))
files->bashrc-d-directory))) files->bashrc-d-directory)))
(description "A service for populating @file{/etc/bashrc.d/} with Bash (description "A service for populating @file{/etc/bashrc.d/} with Bash
scripts having the @file{.sh} file extension, to be sourced by interactive scripts having the @file{.sh} file extension, to be sourced by interactive
Bash shells."))) Bash shells.")
(default-value %default-etc-bashrc-d-files)))
(define (privileged-program->activation-gexp programs) (define (privileged-program->activation-gexp programs)
"Return an activation gexp for privileged-program from PROGRAMS." "Return an activation gexp for privileged-program from PROGRAMS."

View file

@ -969,7 +969,6 @@ of PROVENANCE-SERVICE-TYPE to its services."
nvi nvi
man-db man-db
info-reader ;the standalone Info reader (no Perl) info-reader ;the standalone Info reader (no Perl)
bash-completion
kbd kbd
;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also ;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also
;; want the other commands and the man pages (notably because ;; want the other commands and the man pages (notably because
@ -1155,15 +1154,6 @@ fi
# Provide a default prompt. The user's ~/.bashrc can override it. # Provide a default prompt. The user's ~/.bashrc can override it.
PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
# The 'bash-completion' package.
if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
then
# Bash-completion sources ~/.bash_completion. It installs a dynamic
# completion loader that searches its own completion files as well
# as those in ~/.guix-profile and /run/current-system/profile.
source /run/current-system/profile/etc/profile.d/bash_completion.sh
fi
for i in /etc/bashrc.d/*.sh; do for i in /etc/bashrc.d/*.sh; do
[[ -r $i ]] && source \"$i\" [[ -r $i ]] && source \"$i\"
done done