From ebc7de6a1efb702fd0364128cbde19697966c4f4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 11 Nov 2022 18:54:25 +0100 Subject: services: shepherd: Define 'shepherd-configuration-action' helper. * gnu/services/shepherd.scm (shepherd-configuration-action): New * doc/guix.texi (Shepherd Services): Document it. --- doc/guix.texi | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2d4f7d960e..9dddaf4f2f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -39999,6 +39999,39 @@ This, as you can see, is a fairly sophisticated way to say hello. info on actions. @end deftp +@cindex configuration file, of Shepherd services +@deffn {Scheme Procedure} shepherd-configuration-action +Return a @code{configuration} action to display @var{file}, which should +be the name of the service's configuration file. + +It can be useful to equip services with that action. For example, the +service for the Tor anonymous router (@pxref{Networking Services, +@code{tor-service-type}}) is defined roughly like this: + +@lisp +(let ((torrc (plain-file "torrc" @dots{}))) + (shepherd-service + (provision '(tor)) + (requirement '(user-processes loopback syslogd)) + + (start #~(make-forkexec-constructor + (list #$(file-append tor "/bin/tor") "-f" #$torrc) + #:user "tor" #:group "tor")) + (stop #~(make-kill-destructor)) + (actions (list (shepherd-configuration-action torrc))) + (documentation "Run the Tor anonymous network overlay."))) +@end lisp + +Thanks to this action, administrators can inspect the configuration file +passed to @command{tor} with this shell command: + +@example +cat $(herd configuration tor) +@end example + +This can come in as a handy debugging tool! +@end deffn + @defvr {Scheme Variable} shepherd-root-service-type The service type for the Shepherd ``root service''---i.e., PID@tie{}1. -- cgit 1.4.1