From 8d17cf1c2fcfb48919a10782db7839f1b737f3ea Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Thu, 30 Mar 2017 15:25:58 +1100 Subject: services: Add mail-aliases-service-type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/mail.scm (mail-aliases-etc): New procedure. (mail-aliases-service-type): New variable. Signed-off-by: Ludovic Courtès --- gnu/services/mail.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index 20043d7518..6325589bff 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -35,6 +35,7 @@ #:use-module (guix gexp) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (srfi srfi-1) #:export (dovecot-service dovecot-service-type dovecot-configuration @@ -57,6 +58,8 @@ opensmtpd-service-type %default-opensmtpd-config-file + mail-aliases-service-type + exim-configuration exim-configuration? exim-service-type @@ -1660,6 +1663,31 @@ accept from local for any relay (service-extension shepherd-root-service-type opensmtpd-shepherd-service))))) + +;;; +;;; mail aliases. +;;; + +(define (mail-aliases-etc aliases) + `(("aliases" ,(plain-file "aliases" + ;; Ideally we'd use a format string like + ;; "~:{~a: ~{~a~^,~}\n~}", but it gives a + ;; warning that I can't figure out how to fix, + ;; so we'll just use string-join below instead. + (format #f "~:{~a: ~a\n~}" + (map (match-lambda + ((alias addresses ...) + (list alias (string-join addresses ",")))) + aliases)))))) + +(define mail-aliases-service-type + (service-type + (name 'mail-aliases) + (extensions + (list (service-extension etc-service-type mail-aliases-etc))) + (compose concatenate) + (extend append))) + ;;; ;;; Exim. -- cgit 1.4.1