summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
author宋文武 <iyzsong@member.fsf.org>2019-04-06 22:02:41 +0800
committer宋文武 <iyzsong@member.fsf.org>2019-04-07 14:18:01 +0800
commit412e6396bbb8b398e8a94427db50271e47db610f (patch)
tree9a858253e55ad7fb9e46ab22da94dfb08f92ad57 /gnu/services
parentd3715a30d19d4b49e3a8bbe62c5a1acf074fa748 (diff)
downloadguix-412e6396bbb8b398e8a94427db50271e47db610f.tar.gz
services: Add 'imap4d-service-type'.
* gnu/services/mail.scm (<imap4d-configuration>): New record type.
(imap4d-shepherd-service): New procedure.
(%default-imap4d-config-file, imap4d-service-type): New variables.
* gnu/services/mail.scm (Mail Services): Document it.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/mail.scm45
1 files changed, 44 insertions, 1 deletions
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index a7e8c41d3a..0dabfed4cb 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -64,7 +64,12 @@
             exim-configuration
             exim-configuration?
             exim-service-type
-            %default-exim-config-file))
+            %default-exim-config-file
+
+            imap4d-configuration
+            imap4d-configuration?
+            imap4d-service-type
+            %defualt-imap4d-config-file))
 
 ;;; Commentary:
 ;;;
@@ -1776,3 +1781,41 @@ exim_group = exim
           (service-extension activation-service-type exim-activation)
           (service-extension profile-service-type exim-profile)
           (service-extension mail-aliases-service-type (const '()))))))
+
+
+;;;
+;;; GNU Mailutils IMAP4 Daemon.
+;;;
+
+(define %default-imap4d-config-file
+  (plain-file "imap4d.conf" "server localhost {};\n"))
+
+(define-record-type* <imap4d-configuration>
+  imap4d-configuration make-imap4d-configuration imap4d-configuration?
+  (package     imap4d-configuration-package
+               (default mailutils))
+  (config-file imap4d-configuration-config-file
+               (default %default-imap4d-config-file)))
+
+(define imap4d-shepherd-service
+  (match-lambda
+    (($ <imap4d-configuration> package config-file)
+     (list (shepherd-service
+            (provision '(imap4d))
+            (requirement '(networking syslogd))
+            (documentation "Run the imap4d daemon.")
+            (start (let ((imap4d (file-append package "/sbin/imap4d")))
+                     #~(make-forkexec-constructor
+                        (list #$imap4d "--daemon" "--foreground"
+                              "--config-file" #$config-file))))
+            (stop #~(make-kill-destructor)))))))
+
+(define imap4d-service-type
+  (service-type
+   (name 'imap4d)
+   (description
+    "Run the GNU @command{imap4d} to serve e-mail messages through IMAP.")
+   (extensions
+    (list (service-extension
+           shepherd-root-service-type imap4d-shepherd-service)))
+   (default-value (imap4d-configuration))))