services: opensmtpd: Add 'shepherd-requirement' field.

* gnu/services/mail.scm (<opensmtpd-configuration>)[shepherd-requirement]:
New field.
(opensmtpd-shepherd-service): Honor it.
* doc/guix.texi (Mail Services): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Bruno Victal 2022-12-06 16:52:10 +00:00 committed by Ludovic Courtès
parent 3011e8ae11
commit 00f48860e9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 10 additions and 2 deletions

View file

@ -25729,6 +25729,11 @@ Data type representing the configuration of opensmtpd.
@item @code{package} (default: @var{opensmtpd}) @item @code{package} (default: @var{opensmtpd})
Package object of the OpenSMTPD SMTP server. Package object of the OpenSMTPD SMTP server.
@item @code{shepherd-requirement} (default: @code{'()})
This option can be used to provide a list of symbols naming Shepherd services
that this service will depend on, such as @code{'networking}
if you want to configure OpenSMTPD to listen on non-loopback interfaces.
@item @code{config-file} (default: @code{%default-opensmtpd-config-file}) @item @code{config-file} (default: @code{%default-opensmtpd-config-file})
File-like object of the OpenSMTPD configuration file to use. By default File-like object of the OpenSMTPD configuration file to use. By default
it listens on the loopback network interface, and allows for mail from it listens on the loopback network interface, and allows for mail from

View file

@ -1651,6 +1651,8 @@ (define-record-type* <opensmtpd-configuration>
opensmtpd-configuration? opensmtpd-configuration?
(package opensmtpd-configuration-package (package opensmtpd-configuration-package
(default opensmtpd)) (default opensmtpd))
(shepherd-requirement opensmtpd-configuration-shepherd-requirement
(default '())) ; list of symbols
(config-file opensmtpd-configuration-config-file (config-file opensmtpd-configuration-config-file
(default %default-opensmtpd-config-file)) (default %default-opensmtpd-config-file))
(setgid-commands? opensmtpd-setgid-commands? (default #t))) (setgid-commands? opensmtpd-setgid-commands? (default #t)))
@ -1667,10 +1669,11 @@ (define %default-opensmtpd-config-file
")) "))
(define (opensmtpd-shepherd-service config) (define (opensmtpd-shepherd-service config)
(match-record config <opensmtpd-configuration> (package config-file) (match-record config <opensmtpd-configuration>
(package config-file shepherd-requirement)
(list (shepherd-service (list (shepherd-service
(provision '(smtpd)) (provision '(smtpd))
(requirement '(loopback)) (requirement `(loopback ,@shepherd-requirement))
(documentation "Run the OpenSMTPD daemon.") (documentation "Run the OpenSMTPD daemon.")
(start (let ((smtpd (file-append package "/sbin/smtpd"))) (start (let ((smtpd (file-append package "/sbin/smtpd")))
#~(make-forkexec-constructor #~(make-forkexec-constructor