diff options
-rw-r--r-- | doc/guix.texi | 11 | ||||
-rw-r--r-- | gnu/services/avahi.scm | 5 | ||||
-rw-r--r-- | gnu/services/base.scm | 5 | ||||
-rw-r--r-- | gnu/services/desktop.scm | 12 | ||||
-rw-r--r-- | gnu/services/dict.scm | 3 | ||||
-rw-r--r-- | gnu/services/networking.scm | 4 | ||||
-rw-r--r-- | gnu/services/ssh.scm | 6 | ||||
-rw-r--r-- | gnu/services/web.scm | 7 | ||||
-rw-r--r-- | gnu/services/xorg.scm | 10 | ||||
-rw-r--r-- | gnu/tests/base.scm | 6 |
10 files changed, 50 insertions, 19 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 9dddaf4f2f..eaecfd0daa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17654,6 +17654,17 @@ Service xorg-server has been stopped. Service xorg-server has been started. @end example +@cindex configuration, action for shepherd services +@cindex configuration file, of a shepherd service +For some services, @command{herd configuration} returns the name of the +service's configuration file, which can be handy to inspect its +configuration: + +@example +# herd configuration sshd +/gnu/store/@dots{}-sshd_config +@end example + The following sections document the available services, starting with the core services, that may be used in an @code{operating-system} declaration. diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm index 3b8d0512c7..1c4220e490 100644 --- a/gnu/services/avahi.scm +++ b/gnu/services/avahi.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014-2020, 2022 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -137,7 +137,8 @@ #$@(if debug? #~("--debug") #~()) "-f" #$config) #:pid-file "/run/avahi-daemon/pid")) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action config))))))) (define avahi-service-type (let ((avahi-package (compose list avahi-configuration-avahi))) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 3bf924b8f1..d99548573d 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1327,10 +1327,11 @@ the tty to run, among other things." (loop))))))) (define (nscd-actions nscd config) - "Return Shepherd actions for NSCD." + "Return Shepherd actions for NSCD using CONFIG its config file." ;; Make this functionality available as actions because that's a simple way ;; to run the right 'nscd' binary with the right config file. - (list (shepherd-action + (list (shepherd-configuration-action config) + (shepherd-action (name 'statistics) (documentation "Display statistics about nscd usage.") (procedure (nscd-action-procedure nscd config "--statistics"))) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 1b087635d1..ac29e8d38a 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -273,7 +273,8 @@ #:environment-variables (list (string-append "UPOWER_CONF_FILE_NAME=" #$config)))) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action config))))))) (define upower-service-type (let ((upower-package (compose list upower-configuration-upower))) @@ -1168,6 +1169,9 @@ seats.)" (define (elogind-shepherd-service config) "Return a Shepherd service to start elogind according to @var{config}." + (define config-file + (elogind-configuration-file config)) + (list (shepherd-service (requirement '(dbus-system)) (provision '(elogind)) @@ -1176,9 +1180,9 @@ seats.)" "/libexec/elogind/elogind")) #:environment-variables (list (string-append "ELOGIND_CONF_FILE=" - #$(elogind-configuration-file - config))))) - (stop #~(make-kill-destructor))))) + #$config-file)))) + (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action config-file)))))) (define elogind-service-type (service-type (name 'elogind) diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index f042219cbd..35253a0077 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -182,7 +182,8 @@ database { (stop #~(if (and (defined? 'make-inetd-destructor) #$(= 1 (length interfaces))) ;XXX (make-inetd-destructor) - (make-kill-destructor))))))) + (make-kill-destructor))) + (actions (list (shepherd-configuration-action dicod.conf))))))) (define dicod-service-type (service-type diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 19aba8c266..18d1eb5b8c 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -652,7 +652,8 @@ will keep the system clock synchronized with that of the given servers.") ;; while running, leading shepherd to disable it. To ;; prevent spamming stderr, redirect output to logfile. #:log-file "/var/log/ntpd.log")) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action ntpd.conf))))))) (define (openntpd-service-activation config) "Return the activation gexp for CONFIG." @@ -1032,6 +1033,7 @@ HiddenServicePort ~a ~a~%" (list #$tor "-f" #$torrc) #:user "tor" #:group "tor")) (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action torrc))) (documentation "Run the Tor anonymous network overlay.")))))))) (define (tor-activation config) diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index 72e7183590..7b038e6ac6 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm @@ -524,9 +524,12 @@ of user-name/file-like tuples." (define max-connections (openssh-configuration-max-connections config)) + (define config-file + (openssh-config-file config)) + (define openssh-command #~(list (string-append #$(openssh-configuration-openssh config) "/sbin/sshd") - "-D" "-f" #$(openssh-config-file config))) + "-D" "-f" #$config-file)) (define inetd-style? ;; Whether to use 'make-inetd-constructor'. That procedure appeared in @@ -568,6 +571,7 @@ of user-name/file-like tuples." (stop #~(if #$inetd-style? (make-inetd-destructor) (make-kill-destructor))) + (actions (list (shepherd-configuration-action config-file))) (auto-start? (openssh-auto-start? config))))) (define (openssh-pam-services config) diff --git a/gnu/services/web.scm b/gnu/services/web.scm index f337c90077..83aa97055f 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -790,13 +790,11 @@ of index files." (nginx file run-directory shepherd-requirement) (let* ((nginx-binary (file-append nginx "/sbin/nginx")) (pid-file (in-vicinity run-directory "pid")) + (config-file (or file (default-nginx-config config))) (nginx-action (lambda args #~(lambda _ - (invoke #$nginx-binary "-c" - #$(or file - (default-nginx-config config)) - #$@args) + (invoke #$nginx-binary "-c" #$config-file #$@args) (match '#$args (("-s" . _) #f) (_ @@ -817,6 +815,7 @@ of index files." (stop (nginx-action "-s" "stop")) (actions (list + (shepherd-configuration-action config-file) (shepherd-action (name 'reload) (documentation "Reload nginx configuration file and restart worker processes. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 7f1f0bb581..5f073d05d3 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com> -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013-2017, 2019-2020, 2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> ;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com> ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> @@ -1083,6 +1083,9 @@ argument."))) (gdm-configuration-allow-empty-passwords? config)))) (define (gdm-shepherd-service config) + (define config-file + (gdm-configuration-file config)) + (list (shepherd-service (documentation "Xorg display server (GDM)") (provision '(xorg-server)) @@ -1095,9 +1098,7 @@ argument."))) (list #$@(if (gdm-configuration-auto-suspend? config) #~() #~("DCONF_PROFILE=/etc/dconf/profile/gdm")) - (string-append - "GDM_CUSTOM_CONF=" - #$(gdm-configuration-file config)) + (string-append "GDM_CUSTOM_CONF=" #$config-file) (string-append "GDM_DBUS_DAEMON=" #$(gdm-configuration-dbus-daemon config)) @@ -1129,6 +1130,7 @@ argument."))) "GDM_WAYLAND_SESSION=" #$(gdm-configuration-wayland-session config)))))) (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action config-file))) (respawn? #t)))) (define gdm-polkit-rules diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 87518b4bfe..fe7ca35f60 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -424,6 +424,12 @@ info --version") (x (pk 'failure x #f)))) + (test-assert "nscd configuration action" + (marionette-eval '(with-shepherd-action 'nscd ('configuration) + results + (file-exists? (car results))) + marionette)) + (test-equal "nscd invalidate action" '(#t) ;one value, #t (marionette-eval '(with-shepherd-action 'nscd ('invalidate "hosts") |