[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: services: Add 'imap4d-service-type'.
From: |
guix-commits |
Subject: |
01/01: services: Add 'imap4d-service-type'. |
Date: |
Sun, 7 Apr 2019 02:20:25 -0400 (EDT) |
iyzsong pushed a commit to branch master
in repository guix.
commit 412e6396bbb8b398e8a94427db50271e47db610f
Author: 宋文武 <address@hidden>
Date: Sat Apr 6 22:02:41 2019 +0800
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.
---
doc/guix.texi | 30 ++++++++++++++++++++++++++++++
gnu/services/mail.scm | 45 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1c82579..cecad64 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16559,6 +16559,36 @@ the @code{operating-system}'s @code{user-accounts} in
order to deliver
the @code{postmaster} mail to @code{bob} (which subsequently would
deliver mail to @code{bob@@example.com} and @code{bob@@example2.com}).
address@hidden GNU Mailutils IMAP4 Daemon
address@hidden GNU Mailutils IMAP4 Daemon
+
address@hidden {Scheme Variable} imap4d-service-type
+This is the type of the GNU Mailutils IMAP4 Daemon (@pxref{(mailutils)
+imap4d}), whose value should be an @code{imap4d-configuration} object as in
+this example:
+
address@hidden
+(service imap4d-service-type
+ (imap4d-configuration
+ (config-file (local-file "imap4d.conf"))))
address@hidden example
address@hidden deffn
+
address@hidden {Data Type} imap4d-configuration
+Data type representing the configuration of @command{imap4d}.
+
address@hidden @asis
address@hidden @code{package} (default: @code{mailutils})
+The package that provides @command{imap4d}.
+
address@hidden @code{config-file} (default: @code{%default-imap4d-config-file})
+File-like object of the configuration file to use, by default it will listen
+on the tcp port 143 of @code{localhost}. @xref{(mailutils) Conf-imap4d} for
+details.
+
address@hidden table
address@hidden deftp
+
@node Messaging Services
@subsection Messaging Services
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index a7e8c41..0dabfed 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))))