guix-commits
[Top][All Lists]
Advanced

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

01/06: services: Add mail-aliases-service-type.


From: Ludovic Courtès
Subject: 01/06: services: Add mail-aliases-service-type.
Date: Wed, 19 Apr 2017 17:46:00 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8d17cf1c2fcfb48919a10782db7839f1b737f3ea
Author: Carlo Zancanaro <address@hidden>
Date:   Thu Mar 30 15:25:58 2017 +1100

    services: Add mail-aliases-service-type.
    
    * gnu/services/mail.scm (mail-aliases-etc): New procedure.
    (mail-aliases-service-type): New variable.
    
    Signed-off-by: Ludovic Courtès <address@hidden>
---
 gnu/services/mail.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 20043d7..6325589 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
@@ -1662,6 +1665,31 @@ accept from local for any relay
 
 
 ;;;
+;;; 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.
 ;;;
 



reply via email to

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