This is an automated email from the git hooks/post-receive script.

andreas pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 6036f1f305 services: opensmtpd: Add logging to a file.
6036f1f305 is described below

commit 6036f1f3053bc9b4f0411b5e8aeaab5bd7f4ec7b
Author: Felix Lechner <felix.lech...@lease-up.com>
AuthorDate: Tue Apr 8 14:32:27 2025 -0700

    services: opensmtpd: Add logging to a file.
    
    * gnu/services/mail.scm (opensmtpd-configuration): Add log-file field.
    (opensmtpd-shepherd-service)[start]: Add a command line flag to not
    daemonize. Drop #:pid-file. Add #:log-file.
    * doc/guix.texi (Mail Services): Document the additional parameter.
    
    Change-Id: I485e040d680ccb39fa62e49d2e6ea916f047972c
    Signed-off-by: Andreas Enge <andr...@enge.fr>
---
 doc/guix.texi         | 4 ++++
 gnu/services/mail.scm | 9 ++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bee80cd4e2..c2640e5063 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -29219,6 +29219,10 @@ it listens on the loopback network interface, and 
allows for mail from
 users and daemons on the local machine, as well as permitting email to
 remote servers.  Run @command{man smtpd.conf} for more information.
 
+@item @code{log-file} (default: @code{"/var/log/mail.log"})
+The file location for the OpenSMTPD log file.  Logging occurs in the
+foreground via the Shepherd, i.e. OpenSMTPD does not detach.
+
 @item @code{setgid-commands?} (default: @code{#t})
 Make the following commands setgid to @code{smtpq} so they can be
 executed: @command{smtpctl}, @command{sendmail}, @command{send-mail},
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index ee61887369..eef46d8f63 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2023 Thomas Ieong <th.ie...@free.fr>
 ;;; Copyright © 2023 Saku Laesvuori <s...@laesvuori.fi>
 ;;; Copyright © 2024 Juliana Sims <j...@incana.org>
+;;; Copyright © 2025 Felix Lechner <felix.lech...@lease-up.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1719,6 +1720,8 @@ by @code{dovecot-configuration}.  @var{config} may also 
be created by
                         (default '())) ; list of symbols
   (config-file opensmtpd-configuration-config-file
                (default %default-opensmtpd-config-file))
+  (log-file opensmtpd-configuration-log-file
+            (default "/var/log/mail.log"))
   (setgid-commands? opensmtpd-setgid-commands? (default #t)))
 
 (define %default-opensmtpd-config-file
@@ -1734,15 +1737,15 @@ match from local for any action outbound
 
 (define (opensmtpd-shepherd-service config)
   (match-record config <opensmtpd-configuration>
-                       (package config-file shepherd-requirement)
+                       (package config-file log-file shepherd-requirement)
     (list (shepherd-service
            (provision '(smtpd))
            (requirement `(pam loopback ,@shepherd-requirement))
            (documentation "Run the OpenSMTPD daemon.")
            (start (let ((smtpd (file-append package "/sbin/smtpd")))
                     #~(make-forkexec-constructor
-                       (list #$smtpd "-f" #$config-file)
-                       #:pid-file "/var/run/smtpd.pid")))
+                       (list #$smtpd "-d" "-f" #$config-file)
+                       #:log-file #$log-file)))
            (stop #~(make-kill-destructor))))))
 
 (define %opensmtpd-accounts

Reply via email to