From patchwork Sat Apr 6 14:09:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5a6L5paH5q2m?= X-Patchwork-Id: 3234 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C866516E19; Sat, 6 Apr 2019 15:11:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 69B9E16DA4 for ; Sat, 6 Apr 2019 15:11:11 +0100 (BST) Received: from localhost ([127.0.0.1]:55394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCm2I-0002Km-IQ for patchwork@mira.cbaines.net; Sat, 06 Apr 2019 10:11:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCm2D-0002JO-Ne for guix-patches@gnu.org; Sat, 06 Apr 2019 10:11:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCm2A-0000Va-Bz for guix-patches@gnu.org; Sat, 06 Apr 2019 10:11:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33781) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hCm2A-0000Uv-5L for guix-patches@gnu.org; Sat, 06 Apr 2019 10:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hCm29-0003Bw-Oq for guix-patches@gnu.org; Sat, 06 Apr 2019 10:11:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35170] [PATCH] services: Add 'imap4d-service-type'. Resent-From: =?utf-8?b?5a6L5paH5q2m?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 14:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35170 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35170@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155455984012232 (code B ref -1); Sat, 06 Apr 2019 14:11:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Apr 2019 14:10:40 +0000 Received: from localhost ([127.0.0.1]:47325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCm1n-0003BE-Ef for submit@debbugs.gnu.org; Sat, 06 Apr 2019 10:10:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCm1l-0003Az-Jc for submit@debbugs.gnu.org; Sat, 06 Apr 2019 10:10:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:36686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCm1d-0000IS-VM for submit@debbugs.gnu.org; Sat, 06 Apr 2019 10:10:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCm1c-0001f0-Ky for guix-patches@gnu.org; Sat, 06 Apr 2019 10:10:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCm1W-0000Fk-GB for guix-patches@gnu.org; Sat, 06 Apr 2019 10:10:25 -0400 Received: from rezeros.cc ([2001:19f0:7001:2f3e:5400:ff:fe84:e55d]:48326) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCm1L-00006B-W7 for guix-patches@gnu.org; Sat, 06 Apr 2019 10:10:14 -0400 Received: from localhost (117.173.71.11 [117.173.71.11]) by rezeros.cc (OpenSMTPD) with ESMTPSA id d1abedc9 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 6 Apr 2019 14:10:03 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 5b4f5a56; Sat, 6 Apr 2019 14:09:40 +0000 (UTC) From: =?utf-8?b?5a6L5paH5q2m?= Date: Sat, 6 Apr 2019 22:09:39 +0800 Message-Id: <20190406140939.5324-1-iyzsong@member.fsf.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?5a6L5paH5q2m?= Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/mail.scm (): 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 1c82579afc..cecad64e0c 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}). +@subsubheading GNU Mailutils IMAP4 Daemon +@cindex GNU Mailutils IMAP4 Daemon + +@deffn {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: + +@example +(service imap4d-service-type + (imap4d-configuration + (config-file (local-file "imap4d.conf")))) +@end example +@end deffn + +@deftp {Data Type} imap4d-configuration +Data type representing the configuration of @command{imap4d}. + +@table @asis +@item @code{package} (default: @code{mailutils}) +The package that provides @command{imap4d}. + +@item @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. + +@end table +@end deftp + @node Messaging Services @subsection Messaging Services 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 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 + (($ 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))))