aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2017-03-30 15:25:58 +1100
committerLudovic Courtès <ludo@gnu.org>2017-04-19 23:43:50 +0200
commit8d17cf1c2fcfb48919a10782db7839f1b737f3ea (patch)
treece8e3cb9177d6d25477f2b55e51d1ca660faa030
parente162050dfc0dee708a7ac5bfcf37d2afd6081604 (diff)
downloadpatches-8d17cf1c2fcfb48919a10782db7839f1b737f3ea.tar
patches-8d17cf1c2fcfb48919a10782db7839f1b737f3ea.tar.gz
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 <ludo@gnu.org>
-rw-r--r--gnu/services/mail.scm28
1 files changed, 28 insertions, 0 deletions
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
@@ -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.
;;;