home: home-shepherd-configuration: Add silent? field.

* gnu/home/services/shepherd.scm (home-shepherd-configuration): Add silent? field.
(launch-shepherd-gexp): Conditionally invoke shepherd with --silent.
* doc/guix.texi (home-shepherd-configuration): Document it.

Change-Id: I1ce7a92c2777ebded39fe293b0bdcbd03562b4fc
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Dariqq 2024-10-11 08:39:08 +00:00 committed by Ludovic Courtès
parent ff5072d270
commit 8221a6a1ac
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 10 additions and 1 deletions

View file

@ -46075,6 +46075,10 @@ The Shepherd package to use.
@item auto-start? (default: @code{#t})
Whether or not to start Shepherd on first login.
@item silent? (default: @code{#t})
When true, the @command{shepherd} process does not write
anything to standard output when started automatically.
@item services (default: @code{'()})
A list of @code{<shepherd-service>} to start.
You should probably use the service extension

View file

@ -32,6 +32,7 @@ (define-module (gnu home services shepherd)
home-shepherd-configuration?
home-shepherd-configuration-shepherd
home-shepherd-configuration-auto-start?
home-shepherd-configuration-silent?
home-shepherd-configuration-services)
#:re-export (shepherd-service
shepherd-service?
@ -58,6 +59,8 @@ (define-record-type* <home-shepherd-configuration>
(default #t))
(daemonize? home-shepherd-configuration-daemonize?
(default #t))
(silent? home-shepherd-configuration-silent?
(default #t))
(services home-shepherd-configuration-services
(default '())))
@ -107,7 +110,8 @@ (define (make-user-module)
(scheme-file "shepherd.conf" config)))
(define (launch-shepherd-gexp config)
(let* ((shepherd (home-shepherd-configuration-shepherd config)))
(let* ((shepherd (home-shepherd-configuration-shepherd config))
(silent? (home-shepherd-configuration-silent? config)))
(if (home-shepherd-configuration-auto-start? config)
(with-imported-modules '((guix build utils))
#~(unless (file-exists?
@ -125,6 +129,7 @@ (define (launch-shepherd-gexp config)
#$(file-append shepherd "/bin/shepherd")
"--logfile"
(string-append log-dir "/shepherd.log")
#$@(if silent? '("--silent") '())
"--config"
#$(home-shepherd-configuration-file config)))))
#~"")))