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>
This commit is contained in:
Carlo Zancanaro 2017-03-30 15:25:58 +11:00 committed by Ludovic Courtès
parent e162050dfc
commit 8d17cf1c2f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 28 additions and 0 deletions

View File

@ -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.