From 3349e7c690302d4065261e3a44571a97b340ce32 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 10 Aug 2020 07:55:38 +0200 Subject: [PATCH] service: postfix: Use mail-aliases-service-type. * gnu/services/mail.scm (postfix-service-type): Extend mail-aliases-service-type. (postfix-shepherd-service): Generate /etc/aliases.db if necessary. --- gnu/services/mail.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index e533569c88d..fe8ed224696 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019 Kristofer Buffington ;;; Copyright © 2020 Jonathan Brielmaier ;;; Copyright © 2020 Gábor Boskovits +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -2112,9 +2113,17 @@ inet_protocols = ipv4 (match-record config (postfix) (let* ((postfix-binary (file-append postfix "/postfix")) + (postalias-binary (file-append postfix "/postalias")) (postfix-action (lambda (action) #~(lambda _ + (when (or (not (file-exists? "/etc/aliases.db")) + (> (stat:mtime (stat "/etc/aliases")) + (stat:mtime (stat "/etc/aliases.db")))) + (invoke #$postalias-binary + "-c" + #$(postfix-configuration-directory config) + "/etc/aliases")) (invoke #$postfix-binary "-c" #$(postfix-configuration-directory config) #$action))))) @@ -2130,6 +2139,7 @@ inet_protocols = ipv4 (name 'postfix) (extensions (list (service-extension account-service-type postfix-accounts) (service-extension activation-service-type postfix-activation) - (service-extension shepherd-root-service-type postfix-shepherd-service))) + (service-extension shepherd-root-service-type postfix-shepherd-service) + (service-extension mail-aliases-service-type (const '())))) (description "Run the Postfix MTA.") (default-value (postfix-configuration))))