guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#59860] [PATCH 2/2] services: opensmtpd: Add shepherd-requirement fi


From: mirai
Subject: [bug#59860] [PATCH 2/2] services: opensmtpd: Add shepherd-requirement field.
Date: Tue, 6 Dec 2022 16:52:10 +0000

From: Bruno Victal <mirai@makinata.eu>

---
 doc/guix.texi         | 5 +++++
 gnu/services/mail.scm | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a79b777826..4cf60d7114 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -25730,6 +25730,11 @@ Data type representing the configuration of opensmtpd.
 @item @code{package} (default: @var{opensmtpd})
 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})
 File-like object of the OpenSMTPD configuration file to use.  By default
 it listens on the loopback network interface, and allows for mail from
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index dc4a7986b6..6f588679b1 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1651,6 +1651,8 @@ (define-record-type* <opensmtpd-configuration>
   opensmtpd-configuration?
   (package     opensmtpd-configuration-package
                (default opensmtpd))
+  (shepherd-requirement opensmtpd-configuration-shepherd-requirement
+                        (default '())) ; list of symbols
   (config-file opensmtpd-configuration-config-file
                (default %default-opensmtpd-config-file))
   (setgid-commands? opensmtpd-setgid-commands? (default #t)))
@@ -1667,10 +1669,11 @@ (define %default-opensmtpd-config-file
 "))
 
 (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
            (provision '(smtpd))
-           (requirement '(loopback))
+           (requirement `(loopback ,@shepherd-requirement))
            (documentation "Run the OpenSMTPD daemon.")
            (start (let ((smtpd (file-append package "/sbin/smtpd")))
                     #~(make-forkexec-constructor
-- 
2.38.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]