[PATCH 00/10] Dovecot improvements. Add support for pigeonhole.

  • Open
  • quality assurance status badge
Details
6 participants
  • Efraim Flashner
  • Alexey Abramov via web
  • Alexey Abramov
  • Tobias Geerinckx-Rice
  • Simon Streit
  • Thomas Ieong
Owner
unassigned
Submitted by
Alexey Abramov
Severity
normal
A
A
Alexey Abramov wrote on 17 Aug 2020 11:27
(address . guix-patches@gnu.org)
20200817092748.30057-1-levenson@mmer.org
Hi Guix,

I did some work on dovecot, and now can run it with sieve/managesieve
support. I followed the same aproach NixOS guys did. I patched moduledir in
the source code (/etc/dovecot/modules), and provide it as a symlink to current
system profiles lib/dovecot.

I also added fts plugin support for dovecot, added few more options for sieve
protocol configuration.

Alexey Abramov (10):
gnu: dovecot: Add lucene library to support fts indexing.
gnu: dovecot: Patch and provide a static path for module directory.
services: dovecot: Use modules via symlink to system profile.
gnu: dovecot-pigeonhole: Add new variable.
services: dovecot: Serialize global settings first.
services: dovecot: Only serialize settings with non-empty values.
services: dovecot: Add 'mail-attribute-dict' configuration option.
services: dovecot: Add 'imap-metadata?' protocol configuration option.
services: dovecot: Add 'managesieve-notify-capability' configuration.
services: dovecot: Add 'managesieve-sieve-capability' option.

gnu/local.mk | 1 +
gnu/packages/mail.scm | 68 +++++++-
...ovecot-use-static-path-for-moduledir.patch | 146 +++++++++++++++++
gnu/services/mail.scm | 151 ++++++++++--------
4 files changed, 300 insertions(+), 66 deletions(-)
create mode 100644 gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch

--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 01/10] gnu: dovecot: Add lucene library to support fts indexing.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-1-levenson@mmer.org
* gnu/packages/mail.scm (dovecot)[inputs]: Add ice4c and clucene libraries.
* gnu/packages/mail.scm (dovecot)[arguments]: Add --with-lucene configuration switch.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 6792b9b4a9..98e75fa90f 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -87,6 +87,7 @@
#:use-module (gnu packages guile-xyz)
#:use-module (gnu packages flex)
#:use-module (gnu packages haskell-xyz)
+ #:use-module (gnu packages icu4c)
#:use-module (gnu packages kerberos)
#:use-module (gnu packages libcanberra)
#:use-module (gnu packages libevent)
@@ -113,6 +114,7 @@
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages rdf)
#:use-module (gnu packages ruby)
#:use-module (gnu packages search)
#:use-module (gnu packages serialization)
@@ -1425,11 +1427,14 @@ facilities for checking incoming mail.")
("lz4" ,lz4)
("openssl" ,openssl)
("sqlite" ,sqlite)
- ("zlib" ,zlib)))
+ ("zlib" ,zlib)
+ ("icu4c" ,icu4c)
+ ("clucene" ,clucene)))
(arguments
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
- "--with-sqlite") ; not auto-detected
+ "--with-sqlite" ; not auto-detected
+ "--with-lucene")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 03/10] services: dovecot: Use modules via symlink to system profile.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-3-levenson@mmer.org
* gnu/services/mail.scm (%dovecot-activation): Link the location with multiple
plugins (dovecot-pigeonhole, etc), to a place where dovecot can find them.
* gnu/services/mail.scm (dovecot-configuration): Use the symlink.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index cfcaf4601b..da17933d6b 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1044,7 +1044,7 @@ directories are prefixed with the chroot directory, append \"/.\" to
This is used by imap (for shared users) and lda.")
(mail-plugin-dir
- (file-name "/usr/lib/dovecot")
+ (file-name "/etc/dovecot/modules")
"Directory where to look up mail plugins.")
(mail-plugins
@@ -1519,13 +1519,16 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(else
(format (current-error-port)
"Failed to create public key at ~a.\n" public-key)))))
- (let ((user (getpwnam "dovecot")))
+ (let ((user (getpwnam "dovecot"))
+ (moduledir "/etc/dovecot/modules"))
(mkdir-p/perms "/var/run/dovecot" user #o755)
(mkdir-p/perms "/var/lib/dovecot" user #o755)
(mkdir-p/perms "/etc/dovecot" user #o755)
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (unless (file-exists? moduledir)
+ (symlink "/run/current-system/profile/lib/dovecot" moduledir))
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 04/10] gnu: dovecot-pigeonhole: Add new variable.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-4-levenson@mmer.org
Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/packages/mail.scm | 56 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 8e7d5b2fc1..25e9570958 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1467,6 +1467,62 @@ It supports mbox/Maildir and its own dbox/mdbox formats.")
(license (list license:lgpl2.1 license:expat
(license:non-copyleft "file://COPYING")))))
+(define-public dovecot-pigeonhole
+ (let ((dovecot-version (version-major+minor (package-version dovecot))))
+ (package
+ (name "dovecot-pigeonhole")
+ (version "0.5.11")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://pigeonhole.dovecot.org/releases/"
+ dovecot-version "/"
+ "dovecot-" dovecot-version "-pigeonhole-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1w5mryv6izh1gv7davnl94rb0pvh5bxl2bydzbfla1b83x22m5qb"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)
+ ("pkg-config" ,pkg-config)
+ ("gettext" ,gettext-minimal)
+ ("dovecot" ,dovecot)))
+ (arguments
+ `(#:configure-flags
+ (list "--with-dovecot-install-dirs=no"
+ (string-append "--with-dovecot="
+ (assoc-ref %build-inputs "dovecot")
+ "/lib/dovecot")
+ (string-append "--with-moduledir="
+ (assoc-ref %outputs "out")
+ "/lib/dovecot"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-file-names
+ (lambda _
+ (let ((out (assoc-ref %outputs "out")))
+ (substitute* "src/managesieve/managesieve-settings.c"
+ ((".executable = \"managesieve\"")
+ (string-append ".executable = \"" out "/libexec/dovecot/managesieve\"")))
+ (substitute* "src/managesieve-login/managesieve-login-settings.c"
+ ((".executable = \"managesieve-login\"")
+ (string-append ".executable = \"" out "/libexec/dovecot/managesieve-login\""))))
+ #t)))))
+ (home-page "https://pigeonhole.dovecot.org")
+ (synopsis "Pigeonhole project provides mail filtering facilities using
+the Sieve language")
+ (description
+ "@code{dovecot-pigonhole} adds support for the Sieve
+language (RFC 5228) and the ManageSieve protocol (RFC 5804) to the
+@code{Dovecot} Secure IMAP Server.")
+ ;; Pigeonhole is open source and distributed under the same
+ ;; license as Dovecot: LGPL v2.1
+ (license (list license:lgpl2.1
+ (license:non-copyleft "file://COPYING")
+ (license:non-copyleft "file://COPYING.LGPL"))))))
+
(define-public dovecot-trees
(package
(name "dovecot-trees")
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 05/10] services: dovecot: Serialize global settings first.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-5-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): To avoid dovecot warning
messages, move serialization of protocol settings below the global one.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 118 +++++++++++++++++++++---------------------
1 file changed, 59 insertions(+), 59 deletions(-)

Toggle diff (138 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index da17933d6b..5959d878e7 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -479,64 +479,6 @@ interfaces. If you want to specify non-default ports or anything more
complex, customize the address and port fields of the
@samp{inet-listener} of the specific services you are interested in.")
- (protocols
- (protocol-configuration-list
- (list (protocol-configuration
- (name "imap"))))
- "List of protocols we want to serve. Available protocols include
-@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
-
- (services
- (service-configuration-list
- (list
- (service-configuration
- (kind "imap-login")
- (client-limit 0)
- (process-limit 0)
- (listeners
- (list
- (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
- (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
- (service-configuration
- (kind "pop3-login")
- (listeners
- (list
- (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
- (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
- (service-configuration
- (kind "lmtp")
- (client-limit 1)
- (process-limit 0)
- (listeners
- (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
- (service-configuration
- (kind "imap")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "pop3")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "auth")
- (service-count 0)
- (client-limit 0)
- (process-limit 1)
- (listeners
- (list (unix-listener-configuration (path "auth-userdb")))))
- (service-configuration
- (kind "auth-worker")
- (client-limit 1)
- (process-limit 0))
- (service-configuration
- (kind "dict")
- (client-limit 1)
- (process-limit 0)
- (listeners (list (unix-listener-configuration (path "dict")))))))
- "List of services to enable. Available services include @samp{imap},
-@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
-@samp{lmtp}.")
-
(dict
(dict-configuration (dict-configuration))
"Dict configuration, as created by the @code{dict-configuration}
@@ -1430,7 +1372,65 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(imap-urlauth-host
(string "")
- "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.") )
+ "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.")
+
+ (protocols
+ (protocol-configuration-list
+ (list (protocol-configuration
+ (name "imap"))))
+ "List of protocols we want to serve. Available protocols include
+@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
+
+ (services
+ (service-configuration-list
+ (list
+ (service-configuration
+ (kind "imap-login")
+ (client-limit 0)
+ (process-limit 0)
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
+ (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
+ (service-configuration
+ (kind "pop3-login")
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
+ (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
+ (service-configuration
+ (kind "lmtp")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners
+ (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
+ (service-configuration
+ (kind "imap")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "pop3")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "auth")
+ (service-count 0)
+ (client-limit 0)
+ (process-limit 1)
+ (listeners
+ (list (unix-listener-configuration (path "auth-userdb")))))
+ (service-configuration
+ (kind "auth-worker")
+ (client-limit 1)
+ (process-limit 0))
+ (service-configuration
+ (kind "dict")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners (list (unix-listener-configuration (path "dict")))))))
+ "List of services to enable. Available services include @samp{imap},
+@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
+@samp{lmtp}."))
(define-configuration opaque-dovecot-configuration
(dovecot
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 06/10] services: dovecot: Only serialize settings with non-empty values.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-6-levenson@mmer.org
* gnu/services/mail.scm (serialize-space-separated-string-list): Protocols
might have custom settings, which are not supported by other protocols. To
prevent dovecot/services from crashing, serialize settings that hold non-empty
values only.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 5959d878e7..1d5d322a53 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -99,7 +99,9 @@
(and (string? x) (not (string-index x #\space))))
val)))
(define (serialize-space-separated-string-list field-name val)
- (serialize-field field-name (string-join val " ")))
+ (match val
+ (() #f)
+ (_ (serialize-field field-name (string-join val " ")))))
(define (comma-separated-string-list? val)
(and (list? val)
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 08/10] services: dovecot: Add 'imap-metadata?' protocol configuration option.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-8-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define the option to be able
to activate the IMAP METADATA commands over the imap protocol.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index f2b9774bfd..27ba532338 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -348,7 +348,10 @@ This is used by imap (for shared users) and lda.")
(mail-max-userip-connections
(non-negative-integer 10)
"Maximum number of IMAP connections allowed for a user from each IP
-address. NOTE: The username is compared case-sensitively."))
+address. NOTE: The username is compared case-sensitively.")
+ (imap-metadata?
+ (boolean #f)
+ "Activate the commands of @code{IMAP METADATA} extension (RFC 5464)."))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 07/10] services: dovecot: Add 'mail-attribute-dict' configuration option.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-7-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): Define 'mail-attribute-dict'
directive to support IMAP METADATA extension.:

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 5 +++++
1 file changed, 5 insertions(+)

Toggle diff (18 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 1d5d322a53..f2b9774bfd 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1126,6 +1126,11 @@ disabled.")
@samp{mdbox-rotate-size}. This setting currently works only in Linux
with some file systems (ext4, xfs).")
+ (mail-attribute-dict
+ (string "file:%h/dovecot-attributes")
+ "Activate the metadata storage of @code{IMAP METADATA} extension (RFC 5464), which allows
+per-mailbox, per-user data to be stored and accessed via IMAP commands.")
+
(mail-attachment-dir
(string "")
"sdbox and mdbox support saving mail attachments to external files,
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 09/10] services: dovecot: Add 'managesieve-notify-capability' configuration.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-9-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define new option for
protocol-configuration.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 27ba532338..4b208646b6 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -351,7 +351,13 @@ This is used by imap (for shared users) and lda.")
address. NOTE: The username is compared case-sensitively.")
(imap-metadata?
(boolean #f)
- "Activate the commands of @code{IMAP METADATA} extension (RFC 5464)."))
+ "Activate the commands of @code{IMAP METADATA} extension (RFC 5464).")
+ (managesieve-notify-capability
+ (space-separated-string-list '())
+ "Define NOTIFY capabilities reported by the ManageSieve
+service before authentication. If left unassigned, these will be assigned
+dynamically according to what the Sieve interpreter supports by default (after
+login this may differ depending on the authenticated user)"))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 10/10] services: dovecot: Add 'managesieve-sieve-capability' option.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-10-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (19 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 4b208646b6..7024356842 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -357,6 +357,12 @@ address. NOTE: The username is compared case-sensitively.")
"Define NOTIFY capabilities reported by the ManageSieve
service before authentication. If left unassigned, these will be assigned
dynamically according to what the Sieve interpreter supports by default (after
+login this may differ depending on the authenticated user)")
+ (managesieve-sieve-capability
+ (space-separated-string-list '())
+ "Define SIEVE capabilities reported by the ManageSieve
+service before authentication. If left unassigned, these will be assigned
+dynamically according to what the Sieve interpreter supports by default (after
login this may differ depending on the authenticated user)"))
(define (serialize-protocol-configuration field-name val)
--
2.27.0
A
A
Alexey Abramov wrote on 17 Aug 2020 11:31
[PATCH 02/10] gnu: dovecot: Patch and provide a static path for module directory.
(address . 42899@debbugs.gnu.org)
20200817093124.30611-2-levenson@mmer.org
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch: New file.
* gnu/packages/mail.scm (dovecot)[source]: Use it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/local.mk | 1 +
gnu/packages/mail.scm | 3 +-
...ovecot-use-static-path-for-moduledir.patch | 146 ++++++++++++++++++
3 files changed, 149 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch

Toggle diff (180 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 87bd7094bf..2817deb01f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -900,6 +900,7 @@ dist_patch_DATA = \
%D%/packages/patches/doc++-include-directives.patch \
%D%/packages/patches/doc++-segfault-fix.patch \
%D%/packages/patches/docker-fix-tests.patch \
+ %D%/packages/patches/dovecot-use-static-path-for-moduledir.patch \
%D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch \
%D%/packages/patches/doxygen-test.patch \
%D%/packages/patches/doxygen-1.8.17-runtests.patch \
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 98e75fa90f..8e7d5b2fc1 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1411,7 +1411,8 @@ facilities for checking incoming mail.")
(version-major+minor version) "/"
"dovecot-" version ".tar.gz"))
(sha256
- (base32 "1p5gp8jbavcsaara5mfn5cbrnlxssajnchczbgmmfzr7228fmnfk"))))
+ (base32 "1p5gp8jbavcsaara5mfn5cbrnlxssajnchczbgmmfzr7228fmnfk"))
+ (patches (search-patches "dovecot-use-static-path-for-moduledir.patch"))))
(build-system gnu-build-system)
(native-inputs
`(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch b/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch
new file mode 100644
index 0000000000..da9f4034f4
--- /dev/null
+++ b/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch
@@ -0,0 +1,146 @@
+Subject: [PATCH] Use static path for moduledir.
+
+Patch was taken from NixOS repo. Make dovecot look for plugins in
+/etc/dovecot/modules so we can symlink plugins from several packages
+there.
+
+The rational behind the patch can be found here:
+https://dovecot.org/pipermail/dovecot/2013-April/089931.html
+
+---
+ src/auth/main.c | 4 ++--
+ src/config/config-parser.c | 2 +-
+ src/config/config-parser.h | 2 +-
+ src/dict/main.c | 2 +-
+ src/doveadm/doveadm-util.c | 4 ++--
+ src/lib-fs/fs-api.c | 2 +-
+ src/lib-ssl-iostream/iostream-ssl.c | 4 ++--
+ src/lib-storage/mail-storage-settings.c | 2 +-
+ 9 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/auth/main.c b/src/auth/main.c
+index 2dbf9e176..b1e778ab7 100644
+--- a/src/auth/main.c
++++ b/src/auth/main.c
+@@ -192,7 +192,7 @@ static void main_preinit(void)
+ mod_set.debug = global_auth_settings->debug;
+ mod_set.filter_callback = auth_module_filter;
+
+- modules = module_dir_load(AUTH_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/auth", NULL, &mod_set);
+ module_dir_init(modules);
+
+ if (!worker)
+@@ -223,7 +223,7 @@ void auth_module_load(const char *names)
+ mod_set.debug = global_auth_settings->debug;
+ mod_set.ignore_missing = TRUE;
+
+- modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, names,
++ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/auth", names,
+ &mod_set);
+ module_dir_init(modules);
+ }
+diff --git a/src/config/config-parser.c b/src/config/config-parser.c
+index 6894123ea..07e9fecb4 100644
+--- a/src/config/config-parser.c
++++ b/src/config/config-parser.c
+@@ -1077,7 +1077,7 @@ void config_parse_load_modules(void)
+
+ i_zero(&mod_set);
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+- modules = module_dir_load(CONFIG_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/settings", NULL, &mod_set);
+ module_dir_init(modules);
+
+ i_array_init(&new_roots, 64);
+diff --git a/src/config/config-parser.h b/src/config/config-parser.h
+index e0a0a5bea..32bd76804 100644
+--- a/src/config/config-parser.h
++++ b/src/config/config-parser.h
+@@ -1,7 +1,7 @@
+ #ifndef CONFIG_PARSER_H
+ #define CONFIG_PARSER_H
+
+-#define CONFIG_MODULE_DIR MODULEDIR"/settings"
++#define CONFIG_MODULE_DIR "/etc/dovecot/modules/settings"
+
+ #define IS_WHITE(c) ((c) == ' ' || (c) == '\t')
+
+diff --git a/src/dict/main.c b/src/dict/main.c
+index 722ed025f..4ed12ae5e 100644
+--- a/src/dict/main.c
++++ b/src/dict/main.c
+@@ -104,7 +104,7 @@ static void main_init(void)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.require_init_funcs = TRUE;
+
+- modules = module_dir_load(DICT_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/dict", NULL, &mod_set);
+ module_dir_init(modules);
+
+ /* Register only after loading modules. They may contain SQL drivers,
+diff --git a/src/doveadm/doveadm-util.c b/src/doveadm/doveadm-util.c
+index a65ef7f72..c19eba06c 100644
+--- a/src/doveadm/doveadm-util.c
++++ b/src/doveadm/doveadm-util.c
+@@ -33,7 +33,7 @@ void doveadm_load_modules(void)
+ mod_set.debug = doveadm_debug;
+ mod_set.ignore_dlopen_errors = TRUE;
+
+- modules = module_dir_load_missing(modules, DOVEADM_MODULEDIR,
++ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/doveadm",
+ NULL, &mod_set);
+ module_dir_init(modules);
+ }
+@@ -58,7 +58,7 @@ bool doveadm_has_unloaded_plugin(const char *name)
+ return FALSE;
+ }
+
+- dir = opendir(DOVEADM_MODULEDIR);
++ dir = opendir("/etc/dovecot/modules/doveadm");
+ if (dir == NULL)
+ return FALSE;
+
+diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c
+index a939f612d..846cf86e6 100644
+--- a/src/lib-fs/fs-api.c
++++ b/src/lib-fs/fs-api.c
+@@ -114,7 +114,7 @@ static void fs_class_try_load_plugin(const char *driver)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.ignore_missing = TRUE;
+
+- fs_modules = module_dir_load_missing(fs_modules, MODULE_DIR,
++ fs_modules = module_dir_load_missing(fs_modules, "/etc/dovecot/modules",
+ module_name, &mod_set);
+ module_dir_init(fs_modules);
+
+diff --git a/src/lib-ssl-iostream/iostream-ssl.c b/src/lib-ssl-iostream/iostream-ssl.c
+index f62c80d37..900ab46c4 100644
+--- a/src/lib-ssl-iostream/iostream-ssl.c
++++ b/src/lib-ssl-iostream/iostream-ssl.c
+@@ -54,8 +54,8 @@ int ssl_module_load(const char **error_r)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.setting_name = "<built-in lib-ssl-iostream lookup>";
+ mod_set.require_init_funcs = TRUE;
+- ssl_module = module_dir_load(MODULE_DIR, plugin_name, &mod_set);
+- if (module_dir_try_load_missing(&ssl_module, MODULE_DIR, plugin_name,
++ ssl_module = module_dir_load("/etc/dovecot/modules", plugin_name, &mod_set);
++ if (module_dir_try_load_missing(&ssl_module, "/etc/dovecot/modules", plugin_name,
+ &mod_set, error_r) < 0)
+ return -1;
+ module_dir_init(ssl_module);
+diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c
+index b314b529c..705509456 100644
+--- a/src/lib-storage/mail-storage-settings.c
++++ b/src/lib-storage/mail-storage-settings.c
+@@ -337,7 +337,7 @@ static const struct mail_user_settings mail_user_default_settings = {
+ .last_valid_gid = 0,
+
+ .mail_plugins = "",
+- .mail_plugin_dir = MODULEDIR,
++ .mail_plugin_dir = "/etc/dovecot/modules",
+
+ .mail_log_prefix = "%s(%u)<%{pid}><%{session}>: ",
+
+--
+2.27.0
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 01/10] gnu: dovecot: Add lucene library to support fts indexing.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-1-levenson@mmer.org
* gnu/packages/mail.scm (dovecot)[inputs]: Add ice4c and clucene libraries.
* gnu/packages/mail.scm (dovecot)[arguments]: Add --with-lucene configuration switch.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 6792b9b4a9..98e75fa90f 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -87,6 +87,7 @@
#:use-module (gnu packages guile-xyz)
#:use-module (gnu packages flex)
#:use-module (gnu packages haskell-xyz)
+ #:use-module (gnu packages icu4c)
#:use-module (gnu packages kerberos)
#:use-module (gnu packages libcanberra)
#:use-module (gnu packages libevent)
@@ -113,6 +114,7 @@
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages rdf)
#:use-module (gnu packages ruby)
#:use-module (gnu packages search)
#:use-module (gnu packages serialization)
@@ -1425,11 +1427,14 @@ facilities for checking incoming mail.")
("lz4" ,lz4)
("openssl" ,openssl)
("sqlite" ,sqlite)
- ("zlib" ,zlib)))
+ ("zlib" ,zlib)
+ ("icu4c" ,icu4c)
+ ("clucene" ,clucene)))
(arguments
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
- "--with-sqlite") ; not auto-detected
+ "--with-sqlite" ; not auto-detected
+ "--with-lucene")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 03/10] services: dovecot: Use modules via symlink to system profile.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-3-levenson@mmer.org
* gnu/services/mail.scm (%dovecot-activation): Link the location with multiple
plugins (dovecot-pigeonhole, etc), to a place where dovecot can find them.
* gnu/services/mail.scm (dovecot-configuration): Use the symlink.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
doc/guix.texi | 9 +++++++--
gnu/services/mail.scm | 13 ++++++++++---
2 files changed, 17 insertions(+), 5 deletions(-)

Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index e0c138533f..9f803fdbac 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18333,8 +18333,13 @@ Defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} file-name mail-plugin-dir
-Directory where to look up mail plugins.
-Defaults to @samp{"/usr/lib/dovecot"}.
+Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be
+able to load all those modules by doveconf or services like sieve,
+@samp{mail-plugin-dir} is a symlink "/run/current-system/profile/lib/dovecot",
+which creates during the activation step.
+
+Defaults to @samp{"/etc/dovecot/modules"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mail-plugins
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index cfcaf4601b..2832303d88 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1044,8 +1044,12 @@ directories are prefixed with the chroot directory, append \"/.\" to
This is used by imap (for shared users) and lda.")
(mail-plugin-dir
- (file-name "/usr/lib/dovecot")
- "Directory where to look up mail plugins.")
+ (file-name "/etc/dovecot/modules")
+ "Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be able
+to load all those modules by doveconf or services like imap,
+@samp{mail-plugin-dir} is a symlink `/run/current-system/profile/lib/dovecot`,
+which creates during the activation step.")
(mail-plugins
(space-separated-string-list '())
@@ -1519,13 +1523,16 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(else
(format (current-error-port)
"Failed to create public key at ~a.\n" public-key)))))
- (let ((user (getpwnam "dovecot")))
+ (let ((user (getpwnam "dovecot"))
+ (moduledir "/etc/dovecot/modules"))
(mkdir-p/perms "/var/run/dovecot" user #o755)
(mkdir-p/perms "/var/lib/dovecot" user #o755)
(mkdir-p/perms "/etc/dovecot" user #o755)
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (unless (file-exists? moduledir)
+ (symlink "/run/current-system/profile/lib/dovecot" moduledir))
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 05/10] services: dovecot: Serialize global settings first.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-5-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): To avoid dovecot warning
messages, move serialization of protocol settings below the global one.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 118 +++++++++++++++++++++---------------------
1 file changed, 59 insertions(+), 59 deletions(-)

Toggle diff (138 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2832303d88..a3c48bdb99 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -479,64 +479,6 @@ interfaces. If you want to specify non-default ports or anything more
complex, customize the address and port fields of the
@samp{inet-listener} of the specific services you are interested in.")
- (protocols
- (protocol-configuration-list
- (list (protocol-configuration
- (name "imap"))))
- "List of protocols we want to serve. Available protocols include
-@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
-
- (services
- (service-configuration-list
- (list
- (service-configuration
- (kind "imap-login")
- (client-limit 0)
- (process-limit 0)
- (listeners
- (list
- (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
- (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
- (service-configuration
- (kind "pop3-login")
- (listeners
- (list
- (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
- (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
- (service-configuration
- (kind "lmtp")
- (client-limit 1)
- (process-limit 0)
- (listeners
- (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
- (service-configuration
- (kind "imap")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "pop3")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "auth")
- (service-count 0)
- (client-limit 0)
- (process-limit 1)
- (listeners
- (list (unix-listener-configuration (path "auth-userdb")))))
- (service-configuration
- (kind "auth-worker")
- (client-limit 1)
- (process-limit 0))
- (service-configuration
- (kind "dict")
- (client-limit 1)
- (process-limit 0)
- (listeners (list (unix-listener-configuration (path "dict")))))))
- "List of services to enable. Available services include @samp{imap},
-@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
-@samp{lmtp}.")
-
(dict
(dict-configuration (dict-configuration))
"Dict configuration, as created by the @code{dict-configuration}
@@ -1434,7 +1376,65 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(imap-urlauth-host
(string "")
- "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.") )
+ "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.")
+
+ (protocols
+ (protocol-configuration-list
+ (list (protocol-configuration
+ (name "imap"))))
+ "List of protocols we want to serve. Available protocols include
+@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
+
+ (services
+ (service-configuration-list
+ (list
+ (service-configuration
+ (kind "imap-login")
+ (client-limit 0)
+ (process-limit 0)
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
+ (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
+ (service-configuration
+ (kind "pop3-login")
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
+ (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
+ (service-configuration
+ (kind "lmtp")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners
+ (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
+ (service-configuration
+ (kind "imap")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "pop3")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "auth")
+ (service-count 0)
+ (client-limit 0)
+ (process-limit 1)
+ (listeners
+ (list (unix-listener-configuration (path "auth-userdb")))))
+ (service-configuration
+ (kind "auth-worker")
+ (client-limit 1)
+ (process-limit 0))
+ (service-configuration
+ (kind "dict")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners (list (unix-listener-configuration (path "dict")))))))
+ "List of services to enable. Available services include @samp{imap},
+@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
+@samp{lmtp}."))
(define-configuration opaque-dovecot-configuration
(dovecot
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 06/10] services: dovecot: Only serialize settings with non-empty values.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-6-levenson@mmer.org
* gnu/services/mail.scm (serialize-space-separated-string-list): Protocols
might have custom settings, which are not supported by other protocols. To
prevent dovecot/services from crashing, serialize settings that hold non-empty
values only.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/services/mail.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index a3c48bdb99..6e166af2be 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -99,7 +99,9 @@
(and (string? x) (not (string-index x #\space))))
val)))
(define (serialize-space-separated-string-list field-name val)
- (serialize-field field-name (string-join val " ")))
+ (match val
+ (() #f)
+ (_ (serialize-field field-name (string-join val " ")))))
(define (comma-separated-string-list? val)
(and (list? val)
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 04/10] gnu: dovecot-pigeonhole: Add new variable.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-4-levenson@mmer.org
Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/packages/mail.scm | 56 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 8e7d5b2fc1..25e9570958 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1467,6 +1467,62 @@ It supports mbox/Maildir and its own dbox/mdbox formats.")
(license (list license:lgpl2.1 license:expat
(license:non-copyleft "file://COPYING")))))
+(define-public dovecot-pigeonhole
+ (let ((dovecot-version (version-major+minor (package-version dovecot))))
+ (package
+ (name "dovecot-pigeonhole")
+ (version "0.5.11")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://pigeonhole.dovecot.org/releases/"
+ dovecot-version "/"
+ "dovecot-" dovecot-version "-pigeonhole-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1w5mryv6izh1gv7davnl94rb0pvh5bxl2bydzbfla1b83x22m5qb"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)
+ ("pkg-config" ,pkg-config)
+ ("gettext" ,gettext-minimal)
+ ("dovecot" ,dovecot)))
+ (arguments
+ `(#:configure-flags
+ (list "--with-dovecot-install-dirs=no"
+ (string-append "--with-dovecot="
+ (assoc-ref %build-inputs "dovecot")
+ "/lib/dovecot")
+ (string-append "--with-moduledir="
+ (assoc-ref %outputs "out")
+ "/lib/dovecot"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-file-names
+ (lambda _
+ (let ((out (assoc-ref %outputs "out")))
+ (substitute* "src/managesieve/managesieve-settings.c"
+ ((".executable = \"managesieve\"")
+ (string-append ".executable = \"" out "/libexec/dovecot/managesieve\"")))
+ (substitute* "src/managesieve-login/managesieve-login-settings.c"
+ ((".executable = \"managesieve-login\"")
+ (string-append ".executable = \"" out "/libexec/dovecot/managesieve-login\""))))
+ #t)))))
+ (home-page "https://pigeonhole.dovecot.org")
+ (synopsis "Pigeonhole project provides mail filtering facilities using
+the Sieve language")
+ (description
+ "@code{dovecot-pigonhole} adds support for the Sieve
+language (RFC 5228) and the ManageSieve protocol (RFC 5804) to the
+@code{Dovecot} Secure IMAP Server.")
+ ;; Pigeonhole is open source and distributed under the same
+ ;; license as Dovecot: LGPL v2.1
+ (license (list license:lgpl2.1
+ (license:non-copyleft "file://COPYING")
+ (license:non-copyleft "file://COPYING.LGPL"))))))
+
(define-public dovecot-trees
(package
(name "dovecot-trees")
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 08/10] services: dovecot: Add 'imap-metadata?' protocol configuration option.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-8-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define the option to be able
to activate the IMAP METADATA commands over the imap protocol.
* doc/guix.texi (Mail Services): Document it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
doc/guix.texi | 11 +++++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 18 insertions(+), 1 deletion(-)

Toggle diff (43 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bbdbdf70e1..5c3e706390 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17513,6 +17513,17 @@ This is used by imap (for shared users) and lda.
It defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} boolean imap-metadata?
+Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}.
+
+If activated, a dictionary needs to be configured, via the
+@code{mail-attribute-dict} setting.
+
+Defaults to @samp{#f}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index d8df5c82e4..ee710303e7 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -348,7 +348,13 @@ This is used by imap (for shared users) and lda.")
(mail-max-userip-connections
(non-negative-integer 10)
"Maximum number of IMAP connections allowed for a user from each IP
-address. NOTE: The username is compared case-sensitively."))
+address. NOTE: The username is compared case-sensitively.")
+ (imap-metadata?
+ (boolean #f)
+ "Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
+dictionary needs to be configured, via the @code{mail-attribute-dict}
+setting."))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 07/10] services: dovecot: Add 'mail-attribute-dict' configuration option.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-7-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): Define 'mail-attribute-dict'
directive to support IMAP METADATA extension.:
* doc/guix.texi (Mail Services): Document it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
doc/guix.texi | 15 +++++++++++++++
gnu/services/mail.scm | 11 +++++++++++
2 files changed, 26 insertions(+)

Toggle diff (50 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 9f803fdbac..bbdbdf70e1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18211,6 +18211,21 @@ could allow a user to delete others' mailboxes, or @code{ln -s
@samp{""}.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} string mail-attribute-dict
+Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}. The goal of
+the METADATA extension is to provide a means for clients to set and
+retrieve 'annotations' or 'metadata' on an IMAP server. The annotations
+can be associated with specific mailboxes or the server as a whole. The
+server can choose to support only server annotations or both server and
+mailbox annotations. For example, a general comment being added to a
+mailbox may have an entry name of '/comment' and a value of 'Really
+useful mailbox'
+
+Defaults to @samp{""}.
+
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access?
Allow full file system access to clients. There's no access checks
other than what the operating system does for the active UID/GID. It
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 6e166af2be..d8df5c82e4 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1130,6 +1130,17 @@ disabled.")
@samp{mdbox-rotate-size}. This setting currently works only in Linux
with some file systems (ext4, xfs).")
+ (mail-attribute-dict
+ (string "")
+ "Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. The goal of the
+METADATA extension is to provide a means for clients to set and retrieve
+'annotations' or 'metadata' on an IMAP server. The annotations can be
+associated with specific mailboxes or the server as a whole. The server can
+choose to support only server annotations or both server and mailbox
+annotations. For example, a general comment being added to a mailbox may have
+an entry name of '/comment' and a value of 'Really useful mailbox'")
+
(mail-attachment-dir
(string "")
"sdbox and mdbox support saving mail attachments to external files,
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 09/10] services: dovecot: Add 'managesieve-notify-capability' option.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-9-levenson@mmer.org
* doc/guix.texi (Mail Services): Document it.
* gnu/services/mail.scm (protocol-configuration): Define it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

Toggle diff (41 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5c3e706390..10d4861c4e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17524,6 +17524,15 @@ Defaults to @samp{#f}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-notify-capabilities
+Report notify capabilities by the managesieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default (after login
+this may differ depending on the authenticated user).
+
+Defaults to @samp{()}.
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index ee710303e7..8b57b42dfe 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -354,7 +354,13 @@ address. NOTE: The username is compared case-sensitively.")
"Activate the commands of @code{IMAP METADATA} extension
@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
dictionary needs to be configured, via the @code{mail-attribute-dict}
-setting."))
+setting.")
+ (managesieve-notify-capability
+ (space-separated-string-list '())
+ "Report NOTIFY capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default."))
+
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.27.0
A
A
Alexey Abramov wrote on 18 Aug 2020 14:00
[PATCH v2 02/10] gnu: dovecot: Patch and provide a static path for module directory.
(address . 42899@debbugs.gnu.org)
20200818120037.30722-2-levenson@mmer.org
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch: New file.
* gnu/packages/mail.scm (dovecot)[source]: Use it.

Signed-off-by: Alexey Abramov <levenson@mmer.org>
---
gnu/local.mk | 1 +
gnu/packages/mail.scm | 3 +-
...ovecot-use-static-path-for-moduledir.patch | 146 ++++++++++++++++++
3 files changed, 149 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch

Toggle diff (180 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 87bd7094bf..2817deb01f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -900,6 +900,7 @@ dist_patch_DATA = \
%D%/packages/patches/doc++-include-directives.patch \
%D%/packages/patches/doc++-segfault-fix.patch \
%D%/packages/patches/docker-fix-tests.patch \
+ %D%/packages/patches/dovecot-use-static-path-for-moduledir.patch \
%D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch \
%D%/packages/patches/doxygen-test.patch \
%D%/packages/patches/doxygen-1.8.17-runtests.patch \
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 98e75fa90f..8e7d5b2fc1 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1411,7 +1411,8 @@ facilities for checking incoming mail.")
(version-major+minor version) "/"
"dovecot-" version ".tar.gz"))
(sha256
- (base32 "1p5gp8jbavcsaara5mfn5cbrnlxssajnchczbgmmfzr7228fmnfk"))))
+ (base32 "1p5gp8jbavcsaara5mfn5cbrnlxssajnchczbgmmfzr7228fmnfk"))
+ (patches (search-patches "dovecot-use-static-path-for-moduledir.patch"))))
(build-system gnu-build-system)
(native-inputs
`(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch b/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch
new file mode 100644
index 0000000000..da9f4034f4
--- /dev/null
+++ b/gnu/packages/patches/dovecot-use-static-path-for-moduledir.patch
@@ -0,0 +1,146 @@
+Subject: [PATCH] Use static path for moduledir.
+
+Patch was taken from NixOS repo. Make dovecot look for plugins in
+/etc/dovecot/modules so we can symlink plugins from several packages
+there.
+
+The rational behind the patch can be found here:
+https://dovecot.org/pipermail/dovecot/2013-April/089931.html
+
+---
+ src/auth/main.c | 4 ++--
+ src/config/config-parser.c | 2 +-
+ src/config/config-parser.h | 2 +-
+ src/dict/main.c | 2 +-
+ src/doveadm/doveadm-util.c | 4 ++--
+ src/lib-fs/fs-api.c | 2 +-
+ src/lib-ssl-iostream/iostream-ssl.c | 4 ++--
+ src/lib-storage/mail-storage-settings.c | 2 +-
+ 9 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/auth/main.c b/src/auth/main.c
+index 2dbf9e176..b1e778ab7 100644
+--- a/src/auth/main.c
++++ b/src/auth/main.c
+@@ -192,7 +192,7 @@ static void main_preinit(void)
+ mod_set.debug = global_auth_settings->debug;
+ mod_set.filter_callback = auth_module_filter;
+
+- modules = module_dir_load(AUTH_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/auth", NULL, &mod_set);
+ module_dir_init(modules);
+
+ if (!worker)
+@@ -223,7 +223,7 @@ void auth_module_load(const char *names)
+ mod_set.debug = global_auth_settings->debug;
+ mod_set.ignore_missing = TRUE;
+
+- modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, names,
++ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/auth", names,
+ &mod_set);
+ module_dir_init(modules);
+ }
+diff --git a/src/config/config-parser.c b/src/config/config-parser.c
+index 6894123ea..07e9fecb4 100644
+--- a/src/config/config-parser.c
++++ b/src/config/config-parser.c
+@@ -1077,7 +1077,7 @@ void config_parse_load_modules(void)
+
+ i_zero(&mod_set);
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+- modules = module_dir_load(CONFIG_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/settings", NULL, &mod_set);
+ module_dir_init(modules);
+
+ i_array_init(&new_roots, 64);
+diff --git a/src/config/config-parser.h b/src/config/config-parser.h
+index e0a0a5bea..32bd76804 100644
+--- a/src/config/config-parser.h
++++ b/src/config/config-parser.h
+@@ -1,7 +1,7 @@
+ #ifndef CONFIG_PARSER_H
+ #define CONFIG_PARSER_H
+
+-#define CONFIG_MODULE_DIR MODULEDIR"/settings"
++#define CONFIG_MODULE_DIR "/etc/dovecot/modules/settings"
+
+ #define IS_WHITE(c) ((c) == ' ' || (c) == '\t')
+
+diff --git a/src/dict/main.c b/src/dict/main.c
+index 722ed025f..4ed12ae5e 100644
+--- a/src/dict/main.c
++++ b/src/dict/main.c
+@@ -104,7 +104,7 @@ static void main_init(void)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.require_init_funcs = TRUE;
+
+- modules = module_dir_load(DICT_MODULE_DIR, NULL, &mod_set);
++ modules = module_dir_load("/etc/dovecot/modules/dict", NULL, &mod_set);
+ module_dir_init(modules);
+
+ /* Register only after loading modules. They may contain SQL drivers,
+diff --git a/src/doveadm/doveadm-util.c b/src/doveadm/doveadm-util.c
+index a65ef7f72..c19eba06c 100644
+--- a/src/doveadm/doveadm-util.c
++++ b/src/doveadm/doveadm-util.c
+@@ -33,7 +33,7 @@ void doveadm_load_modules(void)
+ mod_set.debug = doveadm_debug;
+ mod_set.ignore_dlopen_errors = TRUE;
+
+- modules = module_dir_load_missing(modules, DOVEADM_MODULEDIR,
++ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/doveadm",
+ NULL, &mod_set);
+ module_dir_init(modules);
+ }
+@@ -58,7 +58,7 @@ bool doveadm_has_unloaded_plugin(const char *name)
+ return FALSE;
+ }
+
+- dir = opendir(DOVEADM_MODULEDIR);
++ dir = opendir("/etc/dovecot/modules/doveadm");
+ if (dir == NULL)
+ return FALSE;
+
+diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c
+index a939f612d..846cf86e6 100644
+--- a/src/lib-fs/fs-api.c
++++ b/src/lib-fs/fs-api.c
+@@ -114,7 +114,7 @@ static void fs_class_try_load_plugin(const char *driver)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.ignore_missing = TRUE;
+
+- fs_modules = module_dir_load_missing(fs_modules, MODULE_DIR,
++ fs_modules = module_dir_load_missing(fs_modules, "/etc/dovecot/modules",
+ module_name, &mod_set);
+ module_dir_init(fs_modules);
+
+diff --git a/src/lib-ssl-iostream/iostream-ssl.c b/src/lib-ssl-iostream/iostream-ssl.c
+index f62c80d37..900ab46c4 100644
+--- a/src/lib-ssl-iostream/iostream-ssl.c
++++ b/src/lib-ssl-iostream/iostream-ssl.c
+@@ -54,8 +54,8 @@ int ssl_module_load(const char **error_r)
+ mod_set.abi_version = DOVECOT_ABI_VERSION;
+ mod_set.setting_name = "<built-in lib-ssl-iostream lookup>";
+ mod_set.require_init_funcs = TRUE;
+- ssl_module = module_dir_load(MODULE_DIR, plugin_name, &mod_set);
+- if (module_dir_try_load_missing(&ssl_module, MODULE_DIR, plugin_name,
++ ssl_module = module_dir_load("/etc/dovecot/modules", plugin_name, &mod_set);
++ if (module_dir_try_load_missing(&ssl_module, "/etc/dovecot/modules", plugin_name,
+ &mod_set, error_r) < 0)
+ return -1;
+ module_dir_init(ssl_module);
+diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c
+index b314b529c..705509456 100644
+--- a/src/lib-storage/mail-storage-settings.c
++++ b/src/lib-storage/mail-storage-settings.c
+@@ -337,7 +337,7 @@ static const struct mail_user_settings mail_user_default_settings = {
+ .last_valid_gid = 0,
+
+ .mail_plugins = "",
+- .mail_plugin_dir = MODULEDIR,
++ .mail_plugin_dir = "/etc/dovecot/modules",
+
+ .mail_log_prefix = "%s(%u)<%{pid}><%{session}>: ",
+
+--
+2.27.0
--
2.27.0
E
E
Efraim Flashner wrote on 19 Aug 2020 09:41
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
20200819074132.GE10528@E5400
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl8816kACgkQQarn3Mo9
g1G8gg//el7x8zTGlew7YpJsC3oUvk8+O94dlsdyNR9Px1QPjVgEUxPCSwLTwMt2
okQiQiTxtR60pw0RVHQS3YfBVDuDJqCvwfkjZzrt3/AthlG68rh99okEYs5Dh3kJ
SyO7gtNezxm/+nhmhB6f41PlZZF+hT/lR6v5QW745owQyumI7Rj/sp/0Mgy90+81
Wp+65qUoe3Rc/YcPWGOTBeBYTSPaswzK5pXWENiqxGQZ4U2sIHHViwMdVwsH6Jtr
BHNkkm4rQIz+8AqBUiSlHagrEeJrz6n6X9FOg+CnqfIgtrZulxJJyc1+6MoJLgNe
Phc4oa1AlkZyvUFO6zfovsWirI0QnjlHJjkivWZZfIi4yMaEHsoQuSmtajLYt/cD
4xT8F364ix9wEOtmKdYKY0MlGzOMGaos/lyygM/sDUPWbqNLm+ahEhK0fSuAJN5w
0zmOPtgnFUriJvEx69SZhLLhqEe3cgvgGHNggiQgcSxU6Hepzz9fTfx2cNjalpFK
q3+QBLcHjTaDHAOrDL7B7XLwyMM8zJDm7IjF1xJ7K+CxFO8zbYi8S5HOyEmBZu5J
uKI67CDgf6Ail4G6oL87O6i3RIikBStKHAIGt9u98yLBJQgCv8H5twMi0r2wf39y
yQi1LsUWUjVvfyt6zaRurufpi2idWCMaYCjz37ThM5ajsGJg2ig=
=y/Zt
-----END PGP SIGNATURE-----


A
A
Alexey Abramov wrote on 19 Aug 2020 11:44
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 42899@debbugs.gnu.org)
87lfib2cnf.fsf@mmer.org
Hi,

Efraim Flashner <efraim@flashner.co.il> writes:

Toggle quote (4 lines)
> How are all the XXX_MODULE_DIR variables set? Would it be possible to
> just set MODULE_DIR to /etc/dovecot/modules and leave the others as-is?
> They seem to just use a file/folder under MODULE_DIR.

They set during compilation time. If I pass it as a configuration option, dovecot will try to install libraries there which won't work.

For example:

Toggle snippet (14 lines)
-*- mode: rg; default-directory: "~/factory/dovecot/" -*-
rg started at Wed Aug 19 10:35:00

/gnu/store/cxy9n8aic4c9zd0r372m6b6yzw3dhcyl-ripgrep-12.1.1/bin/rg --color always --colors match:fg:red -n --type-add gn\:\*.gn --type-add gn\:\*.gni --type-add gyp\:\*.gyp --type-add gyp\:\*.gypi --no-heading --type all -e AUTH_MODULE_DIR

src/auth/Makefile.am:42: -DAUTH_MODULE_DIR=\""$(auth_moduledir)"\" \
src/auth/main.c:195: modules = module_dir_load(AUTH_MODULE_DIR, NULL, &mod_set);
src/auth/main.c:226: modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, names,
src/doveadm/doveadm-pw.c:40: modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, NULL, &mod_set);
src/doveadm/Makefile.am:28: -DAUTH_MODULE_DIR=\""$(moduledir)/auth"\" \

rg finished (5 matches found) at Wed Aug 19 10:35:00

Toggle snippet (12 lines)
-*- mode: rg; default-directory: "~/factory/dovecot/" -*-
rg started at Wed Aug 19 11:33:25

/gnu/store/cxy9n8aic4c9zd0r372m6b6yzw3dhcyl-ripgrep-12.1.1/bin/rg --color always --colors match:fg:red -n --type-add gn\:\*.gn --type-add gn\:\*.gni --type-add gyp\:\*.gyp --type-add gyp\:\*.gypi --no-heading --type all -e DOVEADM_MODULEDIR

src/doveadm/doveadm-util.c:36: modules = module_dir_load_missing(modules, DOVEADM_MODULEDIR,
src/doveadm/doveadm-util.c:61: dir = opendir(DOVEADM_MODULEDIR);
src/doveadm/Makefile.am:29: -DDOVEADM_MODULEDIR=\""$(doveadm_moduledir)"\" \

rg finished (3 matches found) at Wed Aug 19 11:33:25

--
Alexey
E
E
Efraim Flashner wrote on 23 Aug 2020 22:45
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
20200823204535.GA1392@E5400
On Wed, Aug 19, 2020 at 11:44:20AM +0200, Alexey Abramov wrote:
Toggle quote (10 lines)
> Hi,
>
> Efraim Flashner <efraim@flashner.co.il> writes:
>
> > How are all the XXX_MODULE_DIR variables set? Would it be possible to
> > just set MODULE_DIR to /etc/dovecot/modules and leave the others as-is?
> > They seem to just use a file/folder under MODULE_DIR.
>
> They set during compilation time. If I pass it as a configuration option, dovecot will try to install libraries there which won't work.

This was enough to jog my memory that we have a couple of packages (with
services) that have configure flags for one directory and install to
%outputs as expected. I came up with the attached patch to make that
happen.

Toggle quote (34 lines)
>
> For example:
>
> --8<---------------cut here---------------start------------->8---
> -*- mode: rg; default-directory: "~/factory/dovecot/" -*-
> rg started at Wed Aug 19 10:35:00
>
> /gnu/store/cxy9n8aic4c9zd0r372m6b6yzw3dhcyl-ripgrep-12.1.1/bin/rg --color always --colors match:fg:red -n --type-add gn\:\*.gn --type-add gn\:\*.gni --type-add gyp\:\*.gyp --type-add gyp\:\*.gypi --no-heading --type all -e AUTH_MODULE_DIR
>
> src/auth/Makefile.am:42: -DAUTH_MODULE_DIR=\""$(auth_moduledir)"\" \
> src/auth/main.c:195: modules = module_dir_load(AUTH_MODULE_DIR, NULL, &mod_set);
> src/auth/main.c:226: modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, names,
> src/doveadm/doveadm-pw.c:40: modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, NULL, &mod_set);
> src/doveadm/Makefile.am:28: -DAUTH_MODULE_DIR=\""$(moduledir)/auth"\" \
>
> rg finished (5 matches found) at Wed Aug 19 10:35:00
> --8<---------------cut here---------------end--------------->8---
>
> --8<---------------cut here---------------start------------->8---
> -*- mode: rg; default-directory: "~/factory/dovecot/" -*-
> rg started at Wed Aug 19 11:33:25
>
> /gnu/store/cxy9n8aic4c9zd0r372m6b6yzw3dhcyl-ripgrep-12.1.1/bin/rg --color always --colors match:fg:red -n --type-add gn\:\*.gn --type-add gn\:\*.gni --type-add gyp\:\*.gyp --type-add gyp\:\*.gypi --no-heading --type all -e DOVEADM_MODULEDIR
>
> src/doveadm/doveadm-util.c:36: modules = module_dir_load_missing(modules, DOVEADM_MODULEDIR,
> src/doveadm/doveadm-util.c:61: dir = opendir(DOVEADM_MODULEDIR);
> src/doveadm/Makefile.am:29: -DDOVEADM_MODULEDIR=\""$(doveadm_moduledir)"\" \
>
> rg finished (3 matches found) at Wed Aug 19 11:33:25
> --8<---------------cut here---------------end--------------->8---
>
> --
> Alexey

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
From e4dd3230739bca94896343d64c6756d346016296 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Sun, 23 Aug 2020 23:43:43 +0300
Subject: [PATCH] gnu: dovecot: Set moduledir to global directory.

* gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set
moduledir. Adjust custom 'install phase to override moduledir so it
successfully installs.
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 01ba9dc057..d3d1bda1b6 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1442,7 +1442,8 @@ facilities for checking incoming mail.")
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
"--with-sqlite" ; not auto-detected
- "--with-lucene")
+ "--with-lucene"
+ "--with-moduledir=/etc/dovecot/modules")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
@@ -1459,9 +1460,13 @@ facilities for checking incoming mail.")
(("cat") (which "cat")))
#t))
(replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ ;; The .la files don't like having the moduledir moved.
+ (for-each delete-file (find-files "." "\\.la"))
;; Simple hack to avoid installing a trivial README in /etc.
(apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ (string-append "moduledir=" (assoc-ref outputs "out")
+ "/lib/dovecot")
make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
--
2.28.0
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9C1W8ACgkQQarn3Mo9
g1FHQhAAi0yLjzfMF/yvwGKeYGVpQ8v794xuNW+L1V1GO7TMMBzUFLz+XsJbj81u
h6Yrpw6N24+YtEKtZkCFRwGiD0EjlWhRpZUrIFGznRJs+TphDEix/Zkf8v1slg71
YQmnRsKX3Y0Th3lXcYPqkLy6agVwTS1iucqdwd3orNObzbYeoE433P5K1P7PmsvO
hSHBcIJ7TX1zfxEg2FcV3Z6GRHxlT2OYjndBaaenmS01DkHXEOH3UrRQVMnJircu
EsxbgvF75IIf0DcvNpneNrC53uMcvddxB7Syavk+L64TbXgTPAr+gbW+e1QAajxu
89tXbAM9miH7YFdnJWBzubn8WeKWRqK79UWzebO3kQFjV1mmmYCyknoBLbfsmIn3
vxHkqUY3q6x9x3fRiOvxDA/Nf+9kI9s/YEyZ5GFyMRuxFuGwjZxxmTttU/pqkcJc
2HPpG5aU71OR5lM5qwdMvek+HfbR8qfHtQkkQDTTqDvvw7P4c92EmnPq3713dFze
I4n0RRBuZMT9R3ESW1MMbTbWNV55tL+8wRlJnZaFCsYaiC8vlxJnK03qDtIJp+vv
1XRGC9XHBL44kBjOKoaF1KRID+va0Ac+Zmssh9QQHqsuX+6xMLWK9bnqPlA2TANz
7O1ZkJUaAJIT7k8F8JeK0C1Ri1dcPmRpPbegYpnd/vq5LRTNUpw=
=dFDq
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 23 Aug 2020 23:16
Re: [bug#42899] [PATCH v2 04/10] gnu: dovecot-pigeonhole: Add new variable.
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
20200823211651.GB1392@E5400
Make sure you run 'guix lint' on the package, some of the lines are too
long.

On Tue, Aug 18, 2020 at 02:00:32PM +0200, Alexey Abramov wrote:
Toggle quote (25 lines)
> Signed-off-by: Alexey Abramov <levenson@mmer.org>
> ---
> gnu/packages/mail.scm | 56 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
>
> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index 8e7d5b2fc1..25e9570958 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -1467,6 +1467,62 @@ It supports mbox/Maildir and its own dbox/mdbox formats.")
> (license (list license:lgpl2.1 license:expat
> (license:non-copyleft "file://COPYING")))))
>
> +(define-public dovecot-pigeonhole
> + (let ((dovecot-version (version-major+minor (package-version dovecot))))
> + (package
> + (name "dovecot-pigeonhole")
> + (version "0.5.11")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (string-append "https://pigeonhole.dovecot.org/releases/"
> + dovecot-version "/"
> + "dovecot-" dovecot-version "-pigeonhole-" version ".tar.gz"))

Is there a difference between dovecot-2.3-pigeonhole-0.5.11.tar.gz and
dovecot-2.3.11-pigeonhole-0.5.11.tar.gz?

Toggle quote (12 lines)
> + (sha256
> + (base32
> + "1w5mryv6izh1gv7davnl94rb0pvh5bxl2bydzbfla1b83x22m5qb"))))
> + (build-system gnu-build-system)
> + (native-inputs
> + `(("automake" ,automake)
> + ("autoconf" ,autoconf)
> + ("libtool" ,libtool)
> + ("pkg-config" ,pkg-config)
> + ("gettext" ,gettext-minimal)
> + ("dovecot" ,dovecot)))

it doesn't looke like automake, autoconf, libtool or gettext are
necessary here. Also, 'guix gc --references' show a reference to
dovecot, so that should go in inputs.

Toggle quote (14 lines)
> + (arguments
> + `(#:configure-flags
> + (list "--with-dovecot-install-dirs=no"
> + (string-append "--with-dovecot="
> + (assoc-ref %build-inputs "dovecot")
> + "/lib/dovecot")
> + (string-append "--with-moduledir="
> + (assoc-ref %outputs "out")
> + "/lib/dovecot"))
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'patch-file-names
> + (lambda _

If you change the lambda to (lambda* (#:key outputs #:allow-other-keys)
then you can change the let to (let ((out (assoc-ref outputs "out")))
and it fits better with the code formatting in the rest of Guix.

Toggle quote (8 lines)
> + (let ((out (assoc-ref %outputs "out")))
> + (substitute* "src/managesieve/managesieve-settings.c"
> + ((".executable = \"managesieve\"")
> + (string-append ".executable = \"" out "/libexec/dovecot/managesieve\"")))
> + (substitute* "src/managesieve-login/managesieve-login-settings.c"
> + ((".executable = \"managesieve-login\"")
> + (string-append ".executable = \"" out "/libexec/dovecot/managesieve-login\""))))

Some of these lines are too long. We try to wrap them at 80, and the
linter complains once it hits 90. If you start a new line after 'out'
then it should flow nicely.

Toggle quote (5 lines)
> + #t)))))
> + (home-page "https://pigeonhole.dovecot.org")
> + (synopsis "Pigeonhole project provides mail filtering facilities using
> +the Sieve language")

I would shorten this to 'Mail filtering in Dovecot using the Sieve
language'

Toggle quote (10 lines)
> + (description
> + "@code{dovecot-pigonhole} adds support for the Sieve
> +language (RFC 5228) and the ManageSieve protocol (RFC 5804) to the
> +@code{Dovecot} Secure IMAP Server.")
> + ;; Pigeonhole is open source and distributed under the same
> + ;; license as Dovecot: LGPL v2.1
> + (license (list license:lgpl2.1
> + (license:non-copyleft "file://COPYING")
> + (license:non-copyleft "file://COPYING.LGPL"))))))

It looked to me like it was just lgpl2.1

Toggle quote (11 lines)
> +
> (define-public dovecot-trees
> (package
> (name "dovecot-trees")
> --
> 2.27.0
>
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9C3MAACgkQQarn3Mo9
g1HTIQ/5AR6dCQOjGxe8vDPlpz76qSCVMCg+YEkIZEu1o722H3ofAzkcjmK6zT9E
+N24592XJCmqXE0Y8NKpMeap8TZtxTOOHOTQQ8bDAfsgM7BdblQNAFIHBFZFX+LM
KNGbBfyZTMFs968ZBCYxr4KJd3w9vlATj2/asG5UBbgIqHBEbY4GY636/9D5P8/h
Mj3MMLZiTDEdqNBSWgQH8cT7BOvfpOjamkHfaq7ZbpMEN4f0PQcemmnJVN7do4Fl
GHnjjTrnvnh+SubNCD4vMkytKjpIv2hQeT58QcKtPMyg8UpWnzFbFUg5tRoIX0yC
K5d6xy33NZ6u6q+DKN6CrRE2NjCqksbDRTWfVn8z4dawg30QnbX/vafQzG0rlawi
wOJS5LX7maaIGNqQEI808Luv2MuJyUuLdJq296HBXdJYKa/qbLeqmu+lNkh9+A1V
rjFo6J7cgM0o7yi64k6Nl2UY0pNk6i7i2rme+3p8yeqF/tSx/zZDolbTn3Bwst8Y
oQ7I71MDR69FH5ZrFEfj98yODfM2D4P5v+WAQ27qj9gARxhs4o4mPxdAmswJ1AIp
l1k4xS6Zpv+qwtczIhb2v68gdf3ygdj9KY3jBLZVyEvchCgry1od3ss4q1icu6hB
tP7gup+KlWVEmzR0Q1Iy0z5Ng7v4YtRvBi+ft3uK9MOmuqdHS5w=
=7ZJ5
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 23 Aug 2020 23:18
Re: [bug#42899] [PATCH v2 01/10] gnu: dovecot: Add lucene library to support fts indexing.
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
20200823211840.GC1392@E5400
I've sorted the added libraries alphabetically and pushed this patch.

On Tue, Aug 18, 2020 at 02:00:29PM +0200, Alexey Abramov wrote:
Toggle quote (52 lines)
> * gnu/packages/mail.scm (dovecot)[inputs]: Add ice4c and clucene libraries.
> * gnu/packages/mail.scm (dovecot)[arguments]: Add --with-lucene configuration switch.
>
> Signed-off-by: Alexey Abramov <levenson@mmer.org>
> ---
> gnu/packages/mail.scm | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index 6792b9b4a9..98e75fa90f 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -87,6 +87,7 @@
> #:use-module (gnu packages guile-xyz)
> #:use-module (gnu packages flex)
> #:use-module (gnu packages haskell-xyz)
> + #:use-module (gnu packages icu4c)
> #:use-module (gnu packages kerberos)
> #:use-module (gnu packages libcanberra)
> #:use-module (gnu packages libevent)
> @@ -113,6 +114,7 @@
> #:use-module (gnu packages python-web)
> #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages readline)
> + #:use-module (gnu packages rdf)
> #:use-module (gnu packages ruby)
> #:use-module (gnu packages search)
> #:use-module (gnu packages serialization)
> @@ -1425,11 +1427,14 @@ facilities for checking incoming mail.")
> ("lz4" ,lz4)
> ("openssl" ,openssl)
> ("sqlite" ,sqlite)
> - ("zlib" ,zlib)))
> + ("zlib" ,zlib)
> + ("icu4c" ,icu4c)
> + ("clucene" ,clucene)))
> (arguments
> `(#:configure-flags '("--sysconfdir=/etc"
> "--localstatedir=/var"
> - "--with-sqlite") ; not auto-detected
> + "--with-sqlite" ; not auto-detected
> + "--with-lucene")
> #:phases
> (modify-phases %standard-phases
> (add-after 'unpack 'patch-file-names
> --
> 2.27.0
>
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9C3TAACgkQQarn3Mo9
g1Ft2Q/+OicqChKqL7wfFIDQVRlqXa4lBOwTB9yrupIa7n3OKkj9eEeKCizsbyP2
3/EXvPclB4vP1ktnTCkk4hoBqxfOKbLI/pFyffsW+JxCegDrIW6VvMk/4XBQUncl
v16tGYeyJzoMnkaHBpbPSwhqMT0tc+poLj216b426PhkYPntON2YhCvBUyt/xaYP
8UXiNa4PYl/J+Cvu8ur9OrCfJGTUn4lT3JI+a1YSScQGIHD0l5LFfFlwElJo7XBO
YpARyq6I7Qvxi0b8OLQ2AAUAgqPPuV++anoAs4+XG5MPEza7kjYCl0FB/V2jGamg
mLDhdSUOj9GC37h3579huG1taBJGMxSHkR198khDXXogDpCe1igG/BiN7juXhrOi
hjtU6We/bMcyTU79X3mOOilePIQSHU8MCK7aeymg0HnVWhg+ape4qlHW+I/F/gsK
CNukZx6S9Wq8Y7l1FyH31Zsj4II/20vYBwBjfPQSlsfQJ+er4LLk38zT0BgHByIW
7vymxXYwUS/NIfrdEqSiAw1Rc14QOmnZ/0txeOFI3N4BRNRQzBJ1TCNGgTCJroIS
VZXIF/1vXtccZSClUpcbVxG2hgVvW0KQZnj0Q7LwmeGWRZf7blRNs3SnKu9O1ZdT
s7fxtx2BkDENBGxj2JzgeOoCCuTW4dwhRqsUDiVZJ5jD6I6QKcs=
=Xx5q
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 23 Aug 2020 23:23
Re: [bug#42899] [PATCH 00/10] Dovecot improvements. Add support for pigeonhole.
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
20200823212304.GD1392@E5400
There's some changes to dovecot and the dovecot service here. I don't
use the dovecot service so I don't really feel comfortable reviewing it
in depth.

I believe some of the others who use the dovecot service will be coming
by to test out those bits.


--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9C3jgACgkQQarn3Mo9
g1GZEw/+N0ck1HIQtICTDl4n1JLKMkoMUdl9x1CvjEvC3HpVIokDE+b5T7YyFyCf
7Qyu1REpMHW0HKBOktpYouAb01mNoIwIlHWw8DzKa6dOJqZYwnK29cAFn77mgn0t
FCGr71Pb7hFM1ZPfiBZb1M6kIhkg2wXWEk1qb74+tCBJnzsoOcLzoBlTOksjD5eF
q7auaaS6OzLhJ+KWbKaLbV0QPO2kb25rpA3N90l6IX9swetIAniNM5/boVolidIy
QV8r4PD0WMNeKSzDgvlkjmTrWEb9wIl8Gn29C25dj1NBajMVjOTp8CX7kt3dT9CV
JA5CzbAtYlwc85WzimczJjSbs/+bTWi7s4vEK8TvWA44LQHAvferB8T6L7Jqxxz1
5d+XpdyCF6OxX1wASyoU7SAaJA1ERizH+h8EFvxi12AYhr4FE4CgBEWbCrz0QQ3r
Nt0pc2fyT3UZDfvkcqPSluE8nIVsdfd/cgoHOFOS0/ejOA2pPsPxDcR/Wf71wW3G
8YXj+J2KNyJYi1nqajcV6Hx6oG2Z2tG9BDn27JJCJsBM70yMA+SaLifqe+W4xa+4
eLg2xN0fIT5vDx4fBD2SEmJ1iqmlin24HUuE0o2k7KPX3C3WP3nzRHAqjYTzQFP+
y+OH4zFc2uKJRK6ru76YWsZIu0buUfAwX3ixNzqQzkYJCTbNhEw=
=g0KK
-----END PGP SIGNATURE-----


A
A
Alexey Abramov wrote on 24 Aug 2020 12:01
Re: [bug#42899] [PATCH v2 02/10] gnu: dovecot: Patch and provide a static path for module directory.
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 42899@debbugs.gnu.org)
87blj07472.fsf@mmer.org
Efraim Flashner <efraim@flashner.co.il> writes:

Toggle quote (16 lines)
> On Wed, Aug 19, 2020 at 11:44:20AM +0200, Alexey Abramov wrote:
>> Hi,
>>
>> Efraim Flashner <efraim@flashner.co.il> writes:
>>
>> > How are all the XXX_MODULE_DIR variables set? Would it be possible to
>> > just set MODULE_DIR to /etc/dovecot/modules and leave the others as-is?
>> > They seem to just use a file/folder under MODULE_DIR.
>>
>> They set during compilation time. If I pass it as a configuration option, dovecot will try to install libraries there which won't work.
>
> This was enough to jog my memory that we have a couple of packages (with
> services) that have configure flags for one directory and install to
> %outputs as expected. I came up with the attached patch to make that
> happen.

Thank you very much! I have just tested it, and as you might probably know everything works as expected. I will push your updated patch as soon as guys review the services part.

--
Alexey
A
A
Alexey Abramov wrote on 24 Aug 2020 12:47
Re: [bug#42899] [PATCH v2 04/10] gnu: dovecot-pigeonhole: Add new variable.
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 42899@debbugs.gnu.org)
875z987237.fsf@mmer.org
Efraim Flashner <efraim@flashner.co.il> writes:

Toggle quote (4 lines)
> Make sure you run 'guix lint' on the package, some of the lines are too
> long.
>

[...]

Toggle quote (4 lines)
>
> Is there a difference between dovecot-2.3-pigeonhole-0.5.11.tar.gz and
> dovecot-2.3.11-pigeonhole-0.5.11.tar.gz?

Hm, I didn't even know that you can download the latter one. I used the URL provided from the [1]

Anyways, I have downloaded both of them and did a check. Most of the differences relate to Makefile.in, however I also found that the ChangeLog file from "2.3" is newer then "2.3.11". The latter miss one change. Please see the diff I have attached. So I guess we should use dovecot-2.3-pigeonhole-0.5.11.tar.gz.

Toggle quote (2 lines)
>

[...]

Toggle quote (5 lines)
>
> it doesn't looke like automake, autoconf, libtool or gettext are
> necessary here. Also, 'guix gc --references' show a reference to
> dovecot, so that should go in inputs.

It is indeed not required. I removed native-imports completely and everithing builds OK. I also moved dovecot to inputs, checked 'guix gc --references', but it turned out that it shows dovecot anyways.

,----[ guix gc --references /gnu/store/c6lnlfqh0jxkrz1x8mk7gdpx15iffxqd-dovecot-pigeonhole-0.5.11/ ]
| /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib
| /gnu/store/c6lnlfqh0jxkrz1x8mk7gdpx15iffxqd-dovecot-pigeonhole-0.5.11
| /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31
| /gnu/store/hcxpkksmbql6s4al8yy2myr25kh4cic0-openssl-1.1.1g
| /gnu/store/mhwawv2afb40xv96mdanr2qlqkj6wh8m-dovecot-2.3.11.3
`----

As I understood, it means that if someone have dovecot and dovecot-pigeonhole installed, and the decide to remove pigeonhole, dovecot will be GCed. Please correct me if am wrong.

Toggle quote (2 lines)
>

[...]

Toggle quote (5 lines)
>
> If you change the lambda to (lambda* (#:key outputs #:allow-other-keys)
> then you can change the let to (let ((out (assoc-ref outputs "out")))
> and it fits better with the code formatting in the rest of Guix.

Done.

Toggle quote (2 lines)
>

[...]

Toggle quote (5 lines)
>
> Some of these lines are too long. We try to wrap them at 80, and the
> linter complains once it hits 90. If you start a new line after 'out'
> then it should flow nicely.

Done. Yeah, I saw this, but decided that separating the last argument is not that pretty.

Toggle quote (2 lines)
>

[...]

Toggle quote (4 lines)
>
> I would shorten this to 'Mail filtering in Dovecot using the Sieve
> language'

Done. I am fine with that. As a non native speaker I usually prefer not to touch these kind of things, until I am really sure it can be improved. =)

[...]

Toggle quote (3 lines)
>
> It looked to me like it was just lgpl2.1

Sorry, I am not following. I removed the comment I left indeed. Do you mean I should remove

(license:non-copyleft "file://COPYING")

the part completely? The blob contains both COPYING and COPYING.LGPL so I just copied them both.

Footnotes:

--
Alexey
--- /home/levenson/Downloads/dovecot-2.3-pigeonhole-0.5.11/ChangeLog 2020-08-13 09:11:59.000000000 +0200
+++ /home/levenson/Downloads/dovecot-2.3.11-pigeonhole-0.5.11/ChangeLog 2020-08-12 14:21:42.000000000 +0200
@@ -1,11 +1,3 @@
-2020-08-13 07:45:38 +0300 Aki Tuomi <aki.tuomi@open-xchange.com> (d71e0372)
-
- configure: Fix version number
-
- Broken by ebadd718b918a552fce65ccae6ebaff9d482eb16
-
-M configure.ac
-
2020-06-30 11:53:28 +0300 Aki Tuomi <aki.tuomi@open-xchange.com> (6c69c917)

NEWS: Add news for 0.5.11
T
T
Tobias Geerinckx-Rice wrote on 26 Aug 2020 06:23
Re: [bug#42899] [PATCH 04/10] gnu: dovecot-pigeonhole: Add new variable.
(name . Alexey Abramov)(address . levenson@mmer.org)
878se2vxvm.fsf@nckx
Alexey,

Alexey Abramov ???
Toggle quote (2 lines)
> Signed-off-by: Alexey Abramov <levenson@mmer.org>

No need to sign of on your own patches.

Toggle quote (2 lines)
> +(define-public dovecot-pigeonhole

I've applied these patches on my mail server and will enjoy
testing them. Thanks!

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCX0XjvQAKCRANsP+IT1Vt
eXADAQC2U4g+doyp5nYgmdjRR009+TI6z4NyHsS6sBtdTEgu8gEAszKUHlMLlj95
3iKYJhV8D1qbee/h6VuGFg7pLv4RRQ0=
=yB73
-----END PGP SIGNATURE-----

A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 2/9] services: dovecot: Use modules via symlink to system profile.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-2-levenson@mmer.org
* gnu/services/mail.scm (%dovecot-activation): Link the location with multiple
plugins (dovecot-pigeonhole, etc), to a place where dovecot can find them.
* gnu/services/mail.scm (dovecot-configuration): Use the symlink.
---
doc/guix.texi | 9 +++++++--
gnu/services/mail.scm | 13 ++++++++++---
2 files changed, 17 insertions(+), 5 deletions(-)

Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 0b79a49814..dfa83c409c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18360,8 +18360,13 @@ Defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} file-name mail-plugin-dir
-Directory where to look up mail plugins.
-Defaults to @samp{"/usr/lib/dovecot"}.
+Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be
+able to load all those modules by doveconf or services like sieve,
+@samp{mail-plugin-dir} is a symlink "/run/current-system/profile/lib/dovecot",
+which creates during the activation step.
+
+Defaults to @samp{"/etc/dovecot/modules"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mail-plugins
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index cfcaf4601b..2832303d88 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1044,8 +1044,12 @@ directories are prefixed with the chroot directory, append \"/.\" to
This is used by imap (for shared users) and lda.")
(mail-plugin-dir
- (file-name "/usr/lib/dovecot")
- "Directory where to look up mail plugins.")
+ (file-name "/etc/dovecot/modules")
+ "Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be able
+to load all those modules by doveconf or services like imap,
+@samp{mail-plugin-dir} is a symlink `/run/current-system/profile/lib/dovecot`,
+which creates during the activation step.")
(mail-plugins
(space-separated-string-list '())
@@ -1519,13 +1523,16 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(else
(format (current-error-port)
"Failed to create public key at ~a.\n" public-key)))))
- (let ((user (getpwnam "dovecot")))
+ (let ((user (getpwnam "dovecot"))
+ (moduledir "/etc/dovecot/modules"))
(mkdir-p/perms "/var/run/dovecot" user #o755)
(mkdir-p/perms "/var/lib/dovecot" user #o755)
(mkdir-p/perms "/etc/dovecot" user #o755)
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (unless (file-exists? moduledir)
+ (symlink "/run/current-system/profile/lib/dovecot" moduledir))
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 3/9] gnu: dovecot-pigeonhole: Add new variable.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-3-levenson@mmer.org
---
gnu/packages/mail.scm | 50 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (63 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index c22dd27547..5470144d53 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1481,6 +1481,56 @@ It supports mbox/Maildir and its own dbox/mdbox formats.")
(license (list license:lgpl2.1 license:expat
(license:non-copyleft "file://COPYING")))))
+(define-public dovecot-pigeonhole
+ (let ((dovecot-version (version-major+minor (package-version dovecot))))
+ (package
+ (name "dovecot-pigeonhole")
+ (version "0.5.11")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://pigeonhole.dovecot.org/releases/"
+ dovecot-version "/"
+ "dovecot-" dovecot-version "-pigeonhole-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1w5mryv6izh1gv7davnl94rb0pvh5bxl2bydzbfla1b83x22m5qb"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("dovecot" ,dovecot)))
+ (arguments
+ `(#:configure-flags
+ (list "--with-dovecot-install-dirs=no"
+ (string-append "--with-dovecot="
+ (assoc-ref %build-inputs "dovecot")
+ "/lib/dovecot")
+ (string-append "--with-moduledir="
+ (assoc-ref %outputs "out")
+ "/lib/dovecot"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-file-names
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (substitute* "src/managesieve/managesieve-settings.c"
+ ((".executable = \"managesieve\"")
+ (string-append ".executable = \"" out
+ "/libexec/dovecot/managesieve\"")))
+ (substitute* "src/managesieve-login/managesieve-login-settings.c"
+ ((".executable = \"managesieve-login\"")
+ (string-append ".executable = \"" out
+ "/libexec/dovecot/managesieve-login\""))))
+ #t)))))
+ (home-page "https://pigeonhole.dovecot.org")
+ (synopsis "Mail filtering in Dovecot using the Sieve language")
+ (description
+ "@code{dovecot-pigonhole} adds support for the Sieve
+language (RFC 5228) and the ManageSieve protocol (RFC 5804) to the
+@code{Dovecot} Secure IMAP Server.")
+ (license (list license:lgpl2.1
+ (license:non-copyleft "file://COPYING")
+ (license:non-copyleft "file://COPYING.LGPL"))))))
+
(define-public dovecot-trees
(package
(name "dovecot-trees")
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 1/9] gnu: dovecot: Set moduledir to global directory.
(address . 42899@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
20200827151743.27712-1-levenson@mmer.org
From: Efraim Flashner <efraim@flashner.co.il>

* gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set
moduledir. Adjust custom 'install phase to override moduledir so it
successfully installs.
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 81dc5b8eec..c22dd27547 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1444,7 +1444,8 @@ facilities for checking incoming mail.")
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
"--with-sqlite" ; not auto-detected
- "--with-lucene") ; not auto-detected
+ "--with-lucene" ; not auto-detected
+ "--with-moduledir=/etc/dovecot/modules")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
@@ -1461,9 +1462,13 @@ facilities for checking incoming mail.")
(("cat") (which "cat")))
#t))
(replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ ;; The .la files don't like having the moduledir moved.
+ (for-each delete-file (find-files "." "\\.la"))
;; Simple hack to avoid installing a trivial README in /etc.
(apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ (string-append "moduledir=" (assoc-ref outputs "out")
+ "/lib/dovecot")
make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 7/9] services: dovecot: Add 'imap-metadata?' protocol configuration option.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-7-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define the option to be able
to activate the IMAP METADATA commands over the imap protocol.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 11 +++++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 18 insertions(+), 1 deletion(-)

Toggle diff (43 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index f2124560ae..f46854480b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17540,6 +17540,17 @@ This is used by imap (for shared users) and lda.
It defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} boolean imap-metadata?
+Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}.
+
+If activated, a dictionary needs to be configured, via the
+@code{mail-attribute-dict} setting.
+
+Defaults to @samp{#f}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index d8df5c82e4..ee710303e7 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -348,7 +348,13 @@ This is used by imap (for shared users) and lda.")
(mail-max-userip-connections
(non-negative-integer 10)
"Maximum number of IMAP connections allowed for a user from each IP
-address. NOTE: The username is compared case-sensitively."))
+address. NOTE: The username is compared case-sensitively.")
+ (imap-metadata?
+ (boolean #f)
+ "Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
+dictionary needs to be configured, via the @code{mail-attribute-dict}
+setting."))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 6/9] services: dovecot: Add 'mail-attribute-dict' configuration option.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-6-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): Define 'mail-attribute-dict'
directive to support IMAP METADATA extension.:
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 15 +++++++++++++++
gnu/services/mail.scm | 11 +++++++++++
2 files changed, 26 insertions(+)

Toggle diff (50 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index dfa83c409c..f2124560ae 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18238,6 +18238,21 @@ could allow a user to delete others' mailboxes, or @code{ln -s
@samp{""}.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} string mail-attribute-dict
+Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}. The goal of
+the METADATA extension is to provide a means for clients to set and
+retrieve 'annotations' or 'metadata' on an IMAP server. The annotations
+can be associated with specific mailboxes or the server as a whole. The
+server can choose to support only server annotations or both server and
+mailbox annotations. For example, a general comment being added to a
+mailbox may have an entry name of '/comment' and a value of 'Really
+useful mailbox'
+
+Defaults to @samp{""}.
+
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access?
Allow full file system access to clients. There's no access checks
other than what the operating system does for the active UID/GID. It
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 6e166af2be..d8df5c82e4 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1130,6 +1130,17 @@ disabled.")
@samp{mdbox-rotate-size}. This setting currently works only in Linux
with some file systems (ext4, xfs).")
+ (mail-attribute-dict
+ (string "")
+ "Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. The goal of the
+METADATA extension is to provide a means for clients to set and retrieve
+'annotations' or 'metadata' on an IMAP server. The annotations can be
+associated with specific mailboxes or the server as a whole. The server can
+choose to support only server annotations or both server and mailbox
+annotations. For example, a general comment being added to a mailbox may have
+an entry name of '/comment' and a value of 'Really useful mailbox'")
+
(mail-attachment-dir
(string "")
"sdbox and mdbox support saving mail attachments to external files,
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 9/9] services: dovecot: Add 'managesieve-sieve-capability' option.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-9-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define it.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 7 ++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

Toggle diff (40 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index acccef181f..59377bb678 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17560,6 +17560,15 @@ this may differ depending on the authenticated user).
Defaults to @samp{()}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-sieve-capability
+Report SIEVE capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default.
+
+Defaults to @samp{()}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 8b57b42dfe..91d7041636 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -359,7 +359,12 @@ setting.")
(space-separated-string-list '())
"Report NOTIFY capabilities by the ManageSieve service upon a client
connection. If left unassigned, these will be assigned dynamically
-according to what the Sieve interpreter supports by default."))
+according to what the Sieve interpreter supports by default.")
+ (managesieve-sieve-capability
+ (space-separated-string-list '())
+ "Report SIEVE capabilities by the ManageSieve service upon a client
++connection. If left unassigned, these will be assigned dynamically
++according to what the Sieve interpreter supports by default."))
(define (serialize-protocol-configuration field-name val)
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 8/9] services: dovecot: Add 'managesieve-notify-capability' option.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-8-levenson@mmer.org
* doc/guix.texi (Mail Services): Document it.
* gnu/services/mail.scm (protocol-configuration): Define it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

Toggle diff (41 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index f46854480b..acccef181f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17551,6 +17551,15 @@ Defaults to @samp{#f}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-notify-capabilities
+Report notify capabilities by the managesieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default (after login
+this may differ depending on the authenticated user).
+
+Defaults to @samp{()}.
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index ee710303e7..8b57b42dfe 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -354,7 +354,13 @@ address. NOTE: The username is compared case-sensitively.")
"Activate the commands of @code{IMAP METADATA} extension
@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
dictionary needs to be configured, via the @code{mail-attribute-dict}
-setting."))
+setting.")
+ (managesieve-notify-capability
+ (space-separated-string-list '())
+ "Report NOTIFY capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default."))
+
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 5/9] services: dovecot: Only serialize settings with non-empty values.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-5-levenson@mmer.org
* gnu/services/mail.scm (serialize-space-separated-string-list): Protocols
might have custom settings, which are not supported by other protocols. To
prevent dovecot/services from crashing, serialize settings that hold non-empty
values only.
---
gnu/services/mail.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index a3c48bdb99..6e166af2be 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -99,7 +99,9 @@
(and (string? x) (not (string-index x #\space))))
val)))
(define (serialize-space-separated-string-list field-name val)
- (serialize-field field-name (string-join val " ")))
+ (match val
+ (() #f)
+ (_ (serialize-field field-name (string-join val " ")))))
(define (comma-separated-string-list? val)
(and (list? val)
--
2.28.0
A
A
Alexey Abramov wrote on 27 Aug 2020 17:17
[PATCH v3 4/9] services: dovecot: Serialize global settings first.
(address . 42899@debbugs.gnu.org)
20200827151743.27712-4-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): To avoid dovecot warning
messages, move serialization of protocol settings below the global one.
---
gnu/services/mail.scm | 118 +++++++++++++++++++++---------------------
1 file changed, 59 insertions(+), 59 deletions(-)

Toggle diff (138 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2832303d88..a3c48bdb99 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -479,64 +479,6 @@ interfaces. If you want to specify non-default ports or anything more
complex, customize the address and port fields of the
@samp{inet-listener} of the specific services you are interested in.")
- (protocols
- (protocol-configuration-list
- (list (protocol-configuration
- (name "imap"))))
- "List of protocols we want to serve. Available protocols include
-@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
-
- (services
- (service-configuration-list
- (list
- (service-configuration
- (kind "imap-login")
- (client-limit 0)
- (process-limit 0)
- (listeners
- (list
- (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
- (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
- (service-configuration
- (kind "pop3-login")
- (listeners
- (list
- (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
- (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
- (service-configuration
- (kind "lmtp")
- (client-limit 1)
- (process-limit 0)
- (listeners
- (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
- (service-configuration
- (kind "imap")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "pop3")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "auth")
- (service-count 0)
- (client-limit 0)
- (process-limit 1)
- (listeners
- (list (unix-listener-configuration (path "auth-userdb")))))
- (service-configuration
- (kind "auth-worker")
- (client-limit 1)
- (process-limit 0))
- (service-configuration
- (kind "dict")
- (client-limit 1)
- (process-limit 0)
- (listeners (list (unix-listener-configuration (path "dict")))))))
- "List of services to enable. Available services include @samp{imap},
-@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
-@samp{lmtp}.")
-
(dict
(dict-configuration (dict-configuration))
"Dict configuration, as created by the @code{dict-configuration}
@@ -1434,7 +1376,65 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(imap-urlauth-host
(string "")
- "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.") )
+ "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.")
+
+ (protocols
+ (protocol-configuration-list
+ (list (protocol-configuration
+ (name "imap"))))
+ "List of protocols we want to serve. Available protocols include
+@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
+
+ (services
+ (service-configuration-list
+ (list
+ (service-configuration
+ (kind "imap-login")
+ (client-limit 0)
+ (process-limit 0)
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
+ (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
+ (service-configuration
+ (kind "pop3-login")
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
+ (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
+ (service-configuration
+ (kind "lmtp")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners
+ (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
+ (service-configuration
+ (kind "imap")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "pop3")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "auth")
+ (service-count 0)
+ (client-limit 0)
+ (process-limit 1)
+ (listeners
+ (list (unix-listener-configuration (path "auth-userdb")))))
+ (service-configuration
+ (kind "auth-worker")
+ (client-limit 1)
+ (process-limit 0))
+ (service-configuration
+ (kind "dict")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners (list (unix-listener-configuration (path "dict")))))))
+ "List of services to enable. Available services include @samp{imap},
+@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
+@samp{lmtp}."))
(define-configuration opaque-dovecot-configuration
(dovecot
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:51
[PATCH v4 0/8] Dovecot and pigeonhole improvements.
(address . guix-devel@gnu.org)(address . 42899@debbugs.gnu.org)
20200908135106.17731-1-levenson@mmer.org
Hi Guix,

I have been a happy user of dovecot+pigeonhole for a few weeks now. I am adding @guix-devel to give these changes more attention. dovecot-pigeonhole is already merged, Thank you Tobias.

The next step is to provide some common location where dovecot services can find plugins and their settings. I created /etc/dovecot/modules directory, which is actually a link to "/run/current-system/profile/lib/dovecot" and it is creating during the activation time. By doing this we can make sure, that all dovecot services, those which come with dovecot, can find extensions like sieve/managesieve and their extra settings.

I am using mbsync for my email synchronization. And use the following snippet for my IMAPAccount/IMAPStore.

Toggle snippet (9 lines)
IMAPAccount current-user
Host localhost
User aabramov
Tunnel /run/current-system/profile/libexec/dovecot/imap

IMAPStore current-user
Account current-user

I noticed that when I run imap this way, it reads dovecot configuration, and if some global (dovecot) settings are defined below the service ones, I get a lot of warning message that they won't affect those, and I should move them above in order to make them work. That is why I changed the order of serialization.

I also added some extra settings to the configuration, but those are not for all the services. If you don't apply any values to them, they are still serialized to every service, hence services are crashing with a fatal error. I added a change that will prevent it.

I have rebased my changes and provide v4 series of patches.

Please let me know what you think.

Alexey Abramov (7):
services: dovecot: Use modules via symlink to system profile.
services: dovecot: Serialize global settings first.
services: dovecot: Only serialize settings with non-empty values.
services: dovecot: Add 'mail-attribute-dict' configuration option.
services: dovecot: Add 'imap-metadata?' protocol configuration option.
services: dovecot: Add 'managesieve-notify-capability' option.
services: dovecot: Add 'managesieve-sieve-capability' option.

Efraim Flashner (1):
gnu: dovecot: Set moduledir to global directory.

doc/guix.texi | 53 +++++++++++++-
gnu/packages/mail.scm | 9 ++-
gnu/services/mail.scm | 165 ++++++++++++++++++++++++++----------------
3 files changed, 159 insertions(+), 68 deletions(-)

--
Alexey
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 2/8] services: dovecot: Use modules via symlink to system profile.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-2-levenson@mmer.org
* gnu/services/mail.scm (%dovecot-activation): Link the location with multiple
plugins (dovecot-pigeonhole, etc), to a place where dovecot can find them.
* gnu/services/mail.scm (dovecot-configuration): Use the symlink.
---
doc/guix.texi | 9 +++++++--
gnu/services/mail.scm | 13 ++++++++++---
2 files changed, 17 insertions(+), 5 deletions(-)

Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index f224e356bc..61b65db35b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18613,8 +18613,13 @@ Defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} file-name mail-plugin-dir
-Directory where to look up mail plugins.
-Defaults to @samp{"/usr/lib/dovecot"}.
+Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be
+able to load all those modules by doveconf or services like sieve,
+@samp{mail-plugin-dir} is a symlink "/run/current-system/profile/lib/dovecot",
+which creates during the activation step.
+
+Defaults to @samp{"/etc/dovecot/modules"}.
@end deftypevr
@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mail-plugins
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index cfcaf4601b..2832303d88 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1044,8 +1044,12 @@ directories are prefixed with the chroot directory, append \"/.\" to
This is used by imap (for shared users) and lda.")
(mail-plugin-dir
- (file-name "/usr/lib/dovecot")
- "Directory where to look up mail plugins.")
+ (file-name "/etc/dovecot/modules")
+ "Directory where to look up mail plugins. In Guix, dovecot plugins have
+all its modules under /gnu/store/xxx-plugin/(lib|libexec)/dovecot. To be able
+to load all those modules by doveconf or services like imap,
+@samp{mail-plugin-dir} is a symlink `/run/current-system/profile/lib/dovecot`,
+which creates during the activation step.")
(mail-plugins
(space-separated-string-list '())
@@ -1519,13 +1523,16 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(else
(format (current-error-port)
"Failed to create public key at ~a.\n" public-key)))))
- (let ((user (getpwnam "dovecot")))
+ (let ((user (getpwnam "dovecot"))
+ (moduledir "/etc/dovecot/modules"))
(mkdir-p/perms "/var/run/dovecot" user #o755)
(mkdir-p/perms "/var/lib/dovecot" user #o755)
(mkdir-p/perms "/etc/dovecot" user #o755)
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (unless (file-exists? moduledir)
+ (symlink "/run/current-system/profile/lib/dovecot" moduledir))
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 1/8] gnu: dovecot: Set moduledir to global directory.
(address . 42899@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
20200908135348.18551-1-levenson@mmer.org
From: Efraim Flashner <efraim@flashner.co.il>

* gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set
moduledir. Adjust custom 'install phase to override moduledir so it
successfully installs.
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index beee68c67d..6068736508 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1460,7 +1460,8 @@ facilities for checking incoming mail.")
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
"--with-sqlite" ; not auto-detected
- "--with-lucene") ; not auto-detected
+ "--with-lucene" ; not auto-detected
+ "--with-moduledir=/etc/dovecot/modules")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
@@ -1477,9 +1478,13 @@ facilities for checking incoming mail.")
(("cat") (which "cat")))
#t))
(replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ ;; The .la files don't like having the moduledir moved.
+ (for-each delete-file (find-files "." "\\.la"))
;; Simple hack to avoid installing a trivial README in /etc.
(apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ (string-append "moduledir=" (assoc-ref outputs "out")
+ "/lib/dovecot")
make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 3/8] services: dovecot: Serialize global settings first.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-3-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): To avoid dovecot warning
messages, move serialization of protocol settings below the global one.
---
gnu/services/mail.scm | 118 +++++++++++++++++++++---------------------
1 file changed, 59 insertions(+), 59 deletions(-)

Toggle diff (138 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2832303d88..a3c48bdb99 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -479,64 +479,6 @@ interfaces. If you want to specify non-default ports or anything more
complex, customize the address and port fields of the
@samp{inet-listener} of the specific services you are interested in.")
- (protocols
- (protocol-configuration-list
- (list (protocol-configuration
- (name "imap"))))
- "List of protocols we want to serve. Available protocols include
-@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
-
- (services
- (service-configuration-list
- (list
- (service-configuration
- (kind "imap-login")
- (client-limit 0)
- (process-limit 0)
- (listeners
- (list
- (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
- (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
- (service-configuration
- (kind "pop3-login")
- (listeners
- (list
- (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
- (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
- (service-configuration
- (kind "lmtp")
- (client-limit 1)
- (process-limit 0)
- (listeners
- (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
- (service-configuration
- (kind "imap")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "pop3")
- (client-limit 1)
- (process-limit 1024))
- (service-configuration
- (kind "auth")
- (service-count 0)
- (client-limit 0)
- (process-limit 1)
- (listeners
- (list (unix-listener-configuration (path "auth-userdb")))))
- (service-configuration
- (kind "auth-worker")
- (client-limit 1)
- (process-limit 0))
- (service-configuration
- (kind "dict")
- (client-limit 1)
- (process-limit 0)
- (listeners (list (unix-listener-configuration (path "dict")))))))
- "List of services to enable. Available services include @samp{imap},
-@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
-@samp{lmtp}.")
-
(dict
(dict-configuration (dict-configuration))
"Dict configuration, as created by the @code{dict-configuration}
@@ -1434,7 +1376,65 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(imap-urlauth-host
(string "")
- "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.") )
+ "Host allowed in URLAUTH URLs sent by client. \"*\" allows all.")
+
+ (protocols
+ (protocol-configuration-list
+ (list (protocol-configuration
+ (name "imap"))))
+ "List of protocols we want to serve. Available protocols include
+@samp{imap}, @samp{pop3}, and @samp{lmtp}.")
+
+ (services
+ (service-configuration-list
+ (list
+ (service-configuration
+ (kind "imap-login")
+ (client-limit 0)
+ (process-limit 0)
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
+ (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
+ (service-configuration
+ (kind "pop3-login")
+ (listeners
+ (list
+ (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
+ (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
+ (service-configuration
+ (kind "lmtp")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners
+ (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
+ (service-configuration
+ (kind "imap")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "pop3")
+ (client-limit 1)
+ (process-limit 1024))
+ (service-configuration
+ (kind "auth")
+ (service-count 0)
+ (client-limit 0)
+ (process-limit 1)
+ (listeners
+ (list (unix-listener-configuration (path "auth-userdb")))))
+ (service-configuration
+ (kind "auth-worker")
+ (client-limit 1)
+ (process-limit 0))
+ (service-configuration
+ (kind "dict")
+ (client-limit 1)
+ (process-limit 0)
+ (listeners (list (unix-listener-configuration (path "dict")))))))
+ "List of services to enable. Available services include @samp{imap},
+@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
+@samp{lmtp}."))
(define-configuration opaque-dovecot-configuration
(dovecot
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 4/8] services: dovecot: Only serialize settings with non-empty values.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-4-levenson@mmer.org
* gnu/services/mail.scm (serialize-space-separated-string-list): Protocols
might have custom settings, which are not supported by other protocols. To
prevent dovecot/services from crashing, serialize settings that hold non-empty
values only.
---
gnu/services/mail.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index a3c48bdb99..6e166af2be 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -99,7 +99,9 @@
(and (string? x) (not (string-index x #\space))))
val)))
(define (serialize-space-separated-string-list field-name val)
- (serialize-field field-name (string-join val " ")))
+ (match val
+ (() #f)
+ (_ (serialize-field field-name (string-join val " ")))))
(define (comma-separated-string-list? val)
(and (list? val)
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 5/8] services: dovecot: Add 'mail-attribute-dict' configuration option.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-5-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): Define 'mail-attribute-dict'
directive to support IMAP METADATA extension.:
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 15 +++++++++++++++
gnu/services/mail.scm | 11 +++++++++++
2 files changed, 26 insertions(+)

Toggle diff (50 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 61b65db35b..6d6912febf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18491,6 +18491,21 @@ could allow a user to delete others' mailboxes, or @code{ln -s
@samp{""}.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} string mail-attribute-dict
+Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}. The goal of
+the METADATA extension is to provide a means for clients to set and
+retrieve 'annotations' or 'metadata' on an IMAP server. The annotations
+can be associated with specific mailboxes or the server as a whole. The
+server can choose to support only server annotations or both server and
+mailbox annotations. For example, a general comment being added to a
+mailbox may have an entry name of '/comment' and a value of 'Really
+useful mailbox'
+
+Defaults to @samp{""}.
+
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access?
Allow full file system access to clients. There's no access checks
other than what the operating system does for the active UID/GID. It
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 6e166af2be..d8df5c82e4 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1130,6 +1130,17 @@ disabled.")
@samp{mdbox-rotate-size}. This setting currently works only in Linux
with some file systems (ext4, xfs).")
+ (mail-attribute-dict
+ (string "")
+ "Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. The goal of the
+METADATA extension is to provide a means for clients to set and retrieve
+'annotations' or 'metadata' on an IMAP server. The annotations can be
+associated with specific mailboxes or the server as a whole. The server can
+choose to support only server annotations or both server and mailbox
+annotations. For example, a general comment being added to a mailbox may have
+an entry name of '/comment' and a value of 'Really useful mailbox'")
+
(mail-attachment-dir
(string "")
"sdbox and mdbox support saving mail attachments to external files,
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 6/8] services: dovecot: Add 'imap-metadata?' protocol configuration option.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-6-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define the option to be able
to activate the IMAP METADATA commands over the imap protocol.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 11 +++++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 18 insertions(+), 1 deletion(-)

Toggle diff (43 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 6d6912febf..e5c1d9d2f2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17793,6 +17793,17 @@ This is used by imap (for shared users) and lda.
It defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} boolean imap-metadata?
+Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}.
+
+If activated, a dictionary needs to be configured, via the
+@code{mail-attribute-dict} setting.
+
+Defaults to @samp{#f}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index d8df5c82e4..ee710303e7 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -348,7 +348,13 @@ This is used by imap (for shared users) and lda.")
(mail-max-userip-connections
(non-negative-integer 10)
"Maximum number of IMAP connections allowed for a user from each IP
-address. NOTE: The username is compared case-sensitively."))
+address. NOTE: The username is compared case-sensitively.")
+ (imap-metadata?
+ (boolean #f)
+ "Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
+dictionary needs to be configured, via the @code{mail-attribute-dict}
+setting."))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 7/8] services: dovecot: Add 'managesieve-notify-capability' option.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-7-levenson@mmer.org
* doc/guix.texi (Mail Services): Document it.
* gnu/services/mail.scm (protocol-configuration): Define it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

Toggle diff (41 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index e5c1d9d2f2..8c41a22652 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17804,6 +17804,15 @@ Defaults to @samp{#f}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-notify-capabilities
+Report notify capabilities by the managesieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default (after login
+this may differ depending on the authenticated user).
+
+Defaults to @samp{()}.
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index ee710303e7..8b57b42dfe 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -354,7 +354,13 @@ address. NOTE: The username is compared case-sensitively.")
"Activate the commands of @code{IMAP METADATA} extension
@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
dictionary needs to be configured, via the @code{mail-attribute-dict}
-setting."))
+setting.")
+ (managesieve-notify-capability
+ (space-separated-string-list '())
+ "Report NOTIFY capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default."))
+
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov wrote on 8 Sep 2020 15:53
[PATCH v4 8/8] services: dovecot: Add 'managesieve-sieve-capability' option.
(address . 42899@debbugs.gnu.org)
20200908135348.18551-8-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define it.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 7 ++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

Toggle diff (40 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8c41a22652..d28e7c1b5f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17813,6 +17813,15 @@ this may differ depending on the authenticated user).
Defaults to @samp{()}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-sieve-capability
+Report SIEVE capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default.
+
+Defaults to @samp{()}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 8b57b42dfe..91d7041636 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -359,7 +359,12 @@ setting.")
(space-separated-string-list '())
"Report NOTIFY capabilities by the ManageSieve service upon a client
connection. If left unassigned, these will be assigned dynamically
-according to what the Sieve interpreter supports by default."))
+according to what the Sieve interpreter supports by default.")
+ (managesieve-sieve-capability
+ (space-separated-string-list '())
+ "Report SIEVE capabilities by the ManageSieve service upon a client
++connection. If left unassigned, these will be assigned dynamically
++according to what the Sieve interpreter supports by default."))
(define (serialize-protocol-configuration field-name val)
--
2.28.0
T
T
Tobias Geerinckx-Rice wrote on 8 Sep 2020 16:03
Re: [bug#42899] [PATCH v4 1/8] gnu: dovecot: Set moduledir to global directory.
(name . Alexey Abramov)(address . levenson@mmer.org)(address . 42899@debbugs.gnu.org)
725b4bfa7b58a13006635df595eace7b@tobias.gr
Alexey,

On 2020-09-08 13:53, Alexey Abramov wrote:
Toggle quote (2 lines)
> v4

Thanks! What's changed in v4?

I've been running a Dovecot with your outstanding patches for a week
now, with 0 angry users; I'll review & try to push them later today.

Kind regards,

T G-R

Sent from a Web browser. Excuse or enjoy my brevity.
A
A
Alexey Abramov wrote on 8 Sep 2020 16:21
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 42899@debbugs.gnu.org)
877dt4e4dh.fsf@mmer.org
Hi,

Tobias Geerinckx-Rice <me@tobias.gr> writes:

Toggle quote (10 lines)
> Alexey,
>
> On 2020-09-08 13:53, Alexey Abramov wrote:
>> v4
>
> Thanks! What's changed in v4?
>
> I've been running a Dovecot with your outstanding patches for a week
> now, with 0 angry users; I'll review & try to push them later today.

That was quick, thanks! Glad to hear everything is OK. Well, this time I sent a cover letter to a guix-devel only for some reason. =( I described the changes in general.

V4 doesn't have anything new. I just rebase v3 and provide v4 to let you guys apply/merge/work with them easier. Well, at least, I think it would be easier.

--
Alexey
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 0/6] Dovecot improvements
(address . 42899@debbugs.gnu.org)
20201020150655.12690-1-levenson@mmer.org
I have updated the series. Dovecot modules are provided via computed set of
modules, which is available via /usr/lib/dovecot symlink. All other linux
distribution uses the very same location, so I followed the same rule.

Alexey Abramov (5):
services: dovecot: Provide plugins through a /gnu/store directory.
services: dovecot: Add 'mail-attribute-dict' configuration option.
services: dovecot: Add 'imap-metadata?' protocol configuration option.
services: dovecot: Add 'managesieve-notify-capability' option.
services: dovecot: Add 'managesieve-sieve-capability' option.

Efraim Flashner (1):
gnu: dovecot: Set moduledir to global directory.

doc/guix.texi | 52 ++++++++++++++++++++++++++
gnu/packages/mail.scm | 9 ++++-
gnu/services/mail.scm | 85 +++++++++++++++++++++++++++++++++++++++++--
3 files changed, 141 insertions(+), 5 deletions(-)

--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 2/6] services: dovecot: Provide plugins through a /gnu/store directory.
(address . 42899@debbugs.gnu.org)
20201020150655.12690-3-levenson@mmer.org
* gnu/services/mail.scm (package-list?, serialize-package-list):
* gnu/services/mail.scm (dovecot-configuration)[extensions]: New field. The field
lets you provide a list of dovecot plugins that need to be available during
the runtime. A union of the set of modules will be created on the activation time.
* gnu/services/mail.scm (opaque-dovecot-configuration)[extensions]: Likewise.
* gnu/services/mail.scm (%dovecot-moduledir): New function.
* gnu/services/mail.scm (%dovecot-activation): Add step to compute a set of
modules, and provide them over the shared link at /usr/lib/dovecot.
* doc/guix.texi (Mail Services)[extension]: Add documentation.
---
doc/guix.texi | 8 +++++++
gnu/services/mail.scm | 55 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 2 deletions(-)

Toggle diff (126 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 51dc42e5a2..13cd86779e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18404,6 +18404,14 @@ Available @code{dovecot-configuration} fields are:
The dovecot package.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} package-list extensions
+Plugins and extensions to the Dovecot package. Specify a list of
+dovecot plugins that needs to be available for dovecot and its modules.
+
+Defaults to @samp{()}.
+
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} comma-separated-string-list listen
A list of IPs or hosts where to listen for connections. @samp{*}
listens on all IPv4 interfaces, @samp{::} listens on all IPv6
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 71fa975b5d..b49fc07916 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -468,11 +468,21 @@ as @code{#t}.)")
(serialize-namespace-configuration field-name val))
val))
+(define (package-list? val)
+ (and (list? val) (and-map package? val)))
+(define (serialize-package-list field-name val)
+ #f)
+
(define-configuration dovecot-configuration
(dovecot
(package dovecot)
"The dovecot package.")
+ (extensions
+ (package-list '())
+ "Plugins and extensions to the Dovecot package. Specify a list of dovecot
+plugins that needs to be available for dovecot and its modules.")
+
(listen
(comma-separated-string-list '("*" "::"))
"A list of IPs or hosts where to listen in for connections. @samp{*}
@@ -1439,6 +1449,11 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(package dovecot)
"The dovecot package.")
+ (extensions
+ (package-list '())
+ "Plugins and extensions to the Dovecot package. Specify a list of dovecot
+plugins that needs to be available for dovecot and its modules.")
+
(string
(string (configuration-missing-field 'opaque-dovecot-configuration
'string))
@@ -1464,6 +1479,29 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
+(define (%dovecot-moduledir packages)
+ ;; Create a union of the set of modules and dovecot itself.
+ (computed-file
+ "dovecot-moduledir"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir #$output)
+ (for-each
+ (lambda (package)
+ (let ((path (string-append package "/lib/dovecot")))
+ (for-each
+ (lambda (src)
+ (let* ((tail (substring src (string-length path)))
+ (dst (string-append #$output tail)))
+ (mkdir-p (dirname dst))
+ (if (file-exists? dst)
+ (format (current-error-port) "warning: ~a exists\n" dst)
+ (symlink src dst))))
+ (find-files path))))
+ (list #$@packages))
+ #t))))
+
(define (%dovecot-activation config)
;; Activation gexp.
(let ((config-str
@@ -1474,7 +1512,15 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(with-output-to-string
(lambda ()
(serialize-configuration config
- dovecot-configuration-fields)))))))
+ dovecot-configuration-fields))))))
+ (moduledir-directory
+ (cond
+ ((opaque-dovecot-configuration? config)
+ (%dovecot-moduledir (cons* (opaque-dovecot-configuration-dovecot config)
+ (opaque-dovecot-configuration-extensions config))))
+ (else
+ (%dovecot-moduledir (cons* (dovecot-configuration-dovecot config)
+ (dovecot-configuration-extensions config)))))))
#~(begin
(use-modules (guix build utils))
(define (mkdir-p/perms directory owner perms)
@@ -1521,13 +1567,18 @@ greyed out, instead of only later giving \"not selectable\" popup error.
(else
(format (current-error-port)
"Failed to create public key at ~a.\n" public-key)))))
- (let ((user (getpwnam "dovecot")))
+ (let ((user (getpwnam "dovecot"))
+ (moduledir-symlink "/usr/lib/dovecot"))
(mkdir-p/perms "/var/run/dovecot" user #o755)
(mkdir-p/perms "/var/lib/dovecot" user #o755)
(mkdir-p/perms "/etc/dovecot" user #o755)
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (mkdir-p (dirname moduledir-symlink))
+ (when (file-exists? moduledir-symlink)
+ (delete-file moduledir-symlink))
+ (symlink #$moduledir-directory moduledir-symlink)
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 3/6] services: dovecot: Add 'mail-attribute-dict' configuration option.
(address . 42899@debbugs.gnu.org)
20201020150655.12690-4-levenson@mmer.org
* gnu/services/mail.scm (dovecot-configuration): Define 'mail-attribute-dict'
directive to support IMAP METADATA extension.:
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 15 +++++++++++++++
gnu/services/mail.scm | 11 +++++++++++
2 files changed, 26 insertions(+)

Toggle diff (50 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 13cd86779e..d30cd2c86b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19134,6 +19134,21 @@ could allow a user to delete others' mailboxes, or @code{ln -s
@samp{""}.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} string mail-attribute-dict
+Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}. The goal of
+the METADATA extension is to provide a means for clients to set and
+retrieve 'annotations' or 'metadata' on an IMAP server. The annotations
+can be associated with specific mailboxes or the server as a whole. The
+server can choose to support only server annotations or both server and
+mailbox annotations. For example, a general comment being added to a
+mailbox may have an entry name of '/comment' and a value of 'Really
+useful mailbox'
+
+Defaults to @samp{""}.
+
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access?
Allow full file system access to clients. There's no access checks
other than what the operating system does for the active UID/GID. It
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index b49fc07916..caa8bc5893 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1136,6 +1136,17 @@ disabled.")
@samp{mdbox-rotate-size}. This setting currently works only in Linux
with some file systems (ext4, xfs).")
+ (mail-attribute-dict
+ (string "")
+ "Activate the metadata storage of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. The goal of the
+METADATA extension is to provide a means for clients to set and retrieve
+'annotations' or 'metadata' on an IMAP server. The annotations can be
+associated with specific mailboxes or the server as a whole. The server can
+choose to support only server annotations or both server and mailbox
+annotations. For example, a general comment being added to a mailbox may have
+an entry name of '/comment' and a value of 'Really useful mailbox'")
+
(mail-attachment-dir
(string "")
"sdbox and mdbox support saving mail attachments to external files,
--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 4/6] services: dovecot: Add 'imap-metadata?' protocol configuration option.
(address . 42899@debbugs.gnu.org)
20201020150655.12690-5-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define the option to be able
to activate the IMAP METADATA commands over the imap protocol.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 11 +++++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 18 insertions(+), 1 deletion(-)

Toggle diff (43 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d30cd2c86b..d915d004c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18436,6 +18436,17 @@ This is used by imap (for shared users) and lda.
It defaults to @samp{"/var/run/dovecot/auth-userdb"}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} boolean imap-metadata?
+Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464,RFC@tie{}5464}.
+
+If activated, a dictionary needs to be configured, via the
+@code{mail-attribute-dict} setting.
+
+Defaults to @samp{#f}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index caa8bc5893..0c21da8891 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -348,7 +348,13 @@ This is used by imap (for shared users) and lda.")
(mail-max-userip-connections
(non-negative-integer 10)
"Maximum number of IMAP connections allowed for a user from each IP
-address. NOTE: The username is compared case-sensitively."))
+address. NOTE: The username is compared case-sensitively.")
+ (imap-metadata?
+ (boolean #f)
+ "Activate the commands of @code{IMAP METADATA} extension
+@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
+dictionary needs to be configured, via the @code{mail-attribute-dict}
+setting."))
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 1/6] gnu: dovecot: Set moduledir to global directory.
(address . 42899@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
20201020150655.12690-2-levenson@mmer.org
From: Efraim Flashner <efraim@flashner.co.il>

* gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set
moduledir. Adjust custom 'install phase to override moduledir so it
successfully installs.
---
gnu/packages/mail.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 5056098806..ea53787ce0 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1579,7 +1579,8 @@ facilities for checking incoming mail.")
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
"--with-sqlite" ; not auto-detected
- "--with-lucene") ; not auto-detected
+ "--with-lucene" ; not auto-detected
+ "--with-moduledir=/usr/lib/dovecot")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-file-names
@@ -1596,9 +1597,13 @@ facilities for checking incoming mail.")
(("cat") (which "cat")))
#t))
(replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ ;; The .la files don't like having the moduledir moved.
+ (for-each delete-file (find-files "." "\\.la"))
;; Simple hack to avoid installing a trivial README in /etc.
(apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ (string-append "moduledir=" (assoc-ref outputs "out")
+ "/lib/dovecot")
make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 6/6] services: dovecot: Add 'managesieve-sieve-capability' option.
(address . 42899@debbugs.gnu.org)
20201020150655.12690-7-levenson@mmer.org
* gnu/services/mail.scm (protocol-configuration): Define it.
* doc/guix.texi (Mail Services): Document it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 7 ++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

Toggle diff (40 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index c033868baa..a77e030176 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18456,6 +18456,15 @@ this may differ depending on the authenticated user).
Defaults to @samp{()}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-sieve-capability
+Report SIEVE capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default.
+
+Defaults to @samp{()}.
+
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2066661907..06d9af829d 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -359,7 +359,12 @@ setting.")
(space-separated-string-list '())
"Report NOTIFY capabilities by the ManageSieve service upon a client
connection. If left unassigned, these will be assigned dynamically
-according to what the Sieve interpreter supports by default."))
+according to what the Sieve interpreter supports by default.")
+ (managesieve-sieve-capability
+ (space-separated-string-list '())
+ "Report SIEVE capabilities by the ManageSieve service upon a client
++connection. If left unassigned, these will be assigned dynamically
++according to what the Sieve interpreter supports by default."))
(define (serialize-protocol-configuration field-name val)
--
2.28.0
A
A
Alexey Abramov wrote on 20 Oct 2020 17:06
[PATCH v5 5/6] services: dovecot: Add 'managesieve-notify-capability' option.
(address . 42899@debbugs.gnu.org)
20201020150655.12690-6-levenson@mmer.org
* doc/guix.texi (Mail Services): Document it.
* gnu/services/mail.scm (protocol-configuration): Define it.
---
doc/guix.texi | 9 +++++++++
gnu/services/mail.scm | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

Toggle diff (41 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d915d004c9..c033868baa 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18447,6 +18447,15 @@ Defaults to @samp{#f}.
@end deftypevr
+@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list managesieve-notify-capabilities
+Report notify capabilities by the managesieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default (after login
+this may differ depending on the authenticated user).
+
+Defaults to @samp{()}.
+@end deftypevr
+
@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
Space separated list of plugins to load.
@end deftypevr
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 0c21da8891..2066661907 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -354,7 +354,13 @@ address. NOTE: The username is compared case-sensitively.")
"Activate the commands of @code{IMAP METADATA} extension
@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. If activated, a
dictionary needs to be configured, via the @code{mail-attribute-dict}
-setting."))
+setting.")
+ (managesieve-notify-capability
+ (space-separated-string-list '())
+ "Report NOTIFY capabilities by the ManageSieve service upon a client
+connection. If left unassigned, these will be assigned dynamically
+according to what the Sieve interpreter supports by default."))
+
(define (serialize-protocol-configuration field-name val)
(format #t "protocol ~a {\n" (protocol-configuration-name val))
--
2.28.0
A
A
Alexey Abramov via web wrote on 25 Dec 2020 17:15
[PATCH 00/10] Dovecot improvements. Add support for pigeonhole.
(address . 42899@debbugs.gnu.org)
7f1b41919570.19e3284cda596e07@guile.gnu.org
Just a friendly reminder. Please let me know what you think. Or maybe I missed something.
T
T
Thomas Ieong wrote on 16 Jul 23:37 +0200
(name . Alexey Abramov via web)(address . issues.guix.gnu.org@elephly.net)(address . 42899@debbugs.gnu.org)
87zfqhf27o.fsf@free.fr
Hey,

I'm slowly getting back into contributing to guix again, gonna apply these
patchs and see if we can still make it work.
A
A
Alexey Abramov wrote on 21 Nov 13:25 +0100
[PATCH v6 0/3] services: dovecot: Add pigeonhole support
(address . 42899@debbugs.gnu.org)
20241121122558.8617-1-levenson@mmer.org
Hi everyone,

It is been a while.. I add some changes to the previous series.

- I changed the location of modules to /usr/lib/dovecot instead of
/etc/dovecot. Don't know why). /usr/lib/dovecot seems natural to me.
- I renamed `%dovecot-moduledir' to make-dovecot-moduledir, and now use
union-build to create the union of modules.
- %dovecot-activation uses switch-symlinks now.
- I changed the tests a little bit, so that email will go through a simple
sieve script.

Alexey Abramov (3):
gnu: dovecot: Set moduledir to global directory.
services: dovecot: Provide plugins through a /gnu/store directory.
tests: dovecot: Add sieve.

doc/guix.texi | 19 ++++++++++++
gnu/packages/mail.scm | 8 ++++--
gnu/services/mail.scm | 44 ++++++++++++++++++++++++++--
gnu/tests/mail.scm | 67 +++++++++++++++++++++++++++++++++++++++----
4 files changed, 129 insertions(+), 9 deletions(-)

--
2.46.0
A
A
Alexey Abramov wrote on 21 Nov 13:25 +0100
[PATCH v6 1/3] gnu: dovecot: Set moduledir to global directory.
(address . 42899@debbugs.gnu.org)
20241121122558.8617-2-levenson@mmer.org
* gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set
moduledir. Adjust custom 'install phase to override moduledir so it
successfully installs.
---
gnu/packages/mail.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Toggle diff (30 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 636961aae79..1c537b70a27 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2141,7 +2141,8 @@ (define-public dovecot
`(#:configure-flags '("--sysconfdir=/etc"
"--localstatedir=/var"
"--with-sqlite" ; not auto-detected
- "--with-lucene") ; not auto-detected
+ "--with-lucene"
+ "--with-moduledir=/usr/lib/dovecot") ; not auto-detected
;; The -rdynamic linker flag is needed for the backtrace() function to
;; have symbol names rather than just addresses. Dovecot's tests rely
;; on this, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962630.
@@ -2161,9 +2162,12 @@ (define-public dovecot
"src/lib-smtp/test-bin/sendmail-success.sh")
(("cat") (which "cat")))))
(replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ ;; The .la files don't like having the moduledir moved.
+ (for-each delete-file (find-files "." "\\.la"))
;; Simple hack to avoid installing a trivial README in /etc.
(apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ (string-append "moduledir=" (assoc-ref outputs "out") "/lib/dovecot")
make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
--
2.46.0
A
A
Alexey Abramov wrote on 21 Nov 13:25 +0100
[PATCH v6 2/3] services: dovecot: Provide plugins through a /gnu/store directory.
(address . 42899@debbugs.gnu.org)
20241121122558.8617-3-levenson@mmer.org
* gnu/services/mail.scm (package-list?, serialize-package-list):
* gnu/services/mail.scm (dovecot-configuration)[extensions]: New field. The field
lets you provide a list of dovecot plugins that need to be available during
the runtime. A union of the set of modules will be created on the activation time.
* gnu/services/mail.scm (opaque-dovecot-configuration)[extensions]: Likewise.
* gnu/services/mail.scm (make-dovecot-moduledir): New function.
* gnu/services/mail.scm (%dovecot-activation): Add step to compute a set of
modules, and provide them over the shared link at /usr/lib/dovecot.
* doc/guix.texi (Mail Services)[extension]: Add documentation. Clarify
the purpose and usage of the extensions parameter. Add an example
showing how to enable Sieve filtering using dovecot-pigeonhole. Better
explain the module directory structure and requirements.
---
doc/guix.texi | 19 +++++++++++++++++++
gnu/services/mail.scm | 44 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 2 deletions(-)

Toggle diff (127 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1c39628ffaf..8ab628af0a4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -26629,6 +26629,25 @@ Available @code{dovecot-configuration} fields are:
The dovecot package.
@end deftypevr
+@deftypevr {@code{dovecot-configuration} parameter} package-list extensions
+A list of additional Dovecot plugin packages to make available at runtime. During
+service activation, the @file{lib/dovecot} directory from each specified package
+is combined with Dovecot's core modules into a unified module directory.
+
+For example, to enable Sieve filtering:
+
+@lisp
+(extensions (list dovecot-pigeonhole))
+@end lisp
+
+Each package in the list must provide its modules at @file{lib/dovecot},
+as this is where @code{make-dovecot-moduledir} expects to find its
+extensions. The service combines these directories to create a unified
+module structure.
+
+The default value is an empty list, providing only core Dovecot functionality.
+@end deftypevr
+
@deftypevr {@code{dovecot-configuration} parameter} comma-separated-string-list listen
A list of IPs or hosts where to listen for connections. @samp{*}
listens on all IPv4 interfaces, @samp{::} listens on all IPv6
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 18b482272c7..ce0a37dc5f9 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -521,11 +521,21 @@ (define (serialize-list-of-namespace-configuration field-name val)
(serialize-namespace-configuration field-name val))
val))
+(define (package-list? val)
+ (and (list? val) (and-map package? val)))
+(define (serialize-package-list field-name val)
+ #f)
+
(define-configuration dovecot-configuration
(dovecot
(file-like dovecot)
"The dovecot package.")
+ (extensions
+ (package-list '())
+ "Plugins and extensions to the Dovecot package. Specify a list of dovecot
+plugins that needs to be available for dovecot and its modules.")
+
(listen
(comma-separated-string-list '("*" "::"))
"A list of IPs or hosts where to listen in for connections. @samp{*}
@@ -1109,7 +1119,7 @@ (define-configuration dovecot-configuration
@item fcntl
Use this if possible. Works with NFS too if lockd is used.
@item flock
-May not exist in all systems. Doesn't work with NFS.
+May not exist in all systems. Doesn't work with NFS.
@item lockf
May not exist in all systems. Doesn't work with NFS.
@end table
@@ -1500,6 +1510,11 @@ (define-configuration opaque-dovecot-configuration
(file-like dovecot)
"The dovecot package.")
+ (extensions
+ (package-list '())
+ "Plugins and extensions to the Dovecot package. Specify a list of dovecot
+plugins that needs to be available for dovecot and its modules.")
+
(string
(string (configuration-missing-field 'opaque-dovecot-configuration
'string))
@@ -1525,6 +1540,21 @@ (define %dovecot-accounts
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
+(define (make-dovecot-moduledir packages)
+ "Return a computed file containing a union of Dovecot module directories from PACKAGES.
+Each package's '/lib/dovecot' directory is combined into a single location."
+ ;; Create a union of the set of modules and dovecot itself.
+ (with-imported-modules '((guix build union))
+ (computed-file
+ "dovecot-moduledir"
+ #~(begin
+ (use-modules (guix build union) (srfi srfi-26))
+
+ (union-build #$output
+ (map (cut string-append <>
+ "/lib/dovecot")
+ (list #$@packages)))))))
+
(define (%dovecot-activation config)
;; Activation gexp.
(let ((config-str
@@ -1535,7 +1565,15 @@ (define (%dovecot-activation config)
(with-output-to-string
(lambda ()
(serialize-configuration config
- dovecot-configuration-fields)))))))
+ dovecot-configuration-fields))))))
+ (moduledir-directory
+ (cond
+ ((opaque-dovecot-configuration? config)
+ (make-dovecot-moduledir (cons* (opaque-dovecot-configuration-dovecot config)
+ (opaque-dovecot-configuration-extensions config))))
+ (else
+ (make-dovecot-moduledir (cons* (dovecot-configuration-dovecot config)
+ (dovecot-configuration-extensions config)))))))
(with-imported-modules (source-module-closure '((gnu build activation)))
#~(begin
(use-modules (guix build utils) (gnu build activation))
@@ -1586,6 +1624,8 @@ (define* (create-self-signed-certificate-if-absent
(copy-file #$(plain-file "dovecot.conf" config-str)
"/etc/dovecot/dovecot.conf")
(mkdir-p/perms "/etc/dovecot/private" user #o700)
+ (mkdir-p "/usr/lib")
+ (switch-symlinks "/usr/lib/dovecot" #$moduledir-directory)
(create-self-signed-certificate-if-absent
#:private-key "/etc/dovecot/private/default.pem"
#:public-key "/etc/dovecot/default.pem"
--
2.46.0
A
A
Alexey Abramov wrote on 21 Nov 13:25 +0100
[PATCH v6 3/3] tests: dovecot: Add sieve.
(address . 42899@debbugs.gnu.org)
20241121122558.8617-4-levenson@mmer.org
* gnu/tests/mail.scm (%dovecot-os): Add dovecot-pigeonhole and simple
imapsieve configuration.
* gnu/tests/mail.scm (run-dovecot-test): Define simple sieve
script. Add SELECT TESTBOX step to let dovecot properly do mailbox
synchronization.
---
gnu/tests/mail.scm | 67 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 62 insertions(+), 5 deletions(-)

Toggle diff (112 lines)
diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index 176e7c1d074..3b498b5b575 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -297,10 +297,42 @@ (define %dovecot-os
(service dhcp-client-service-type)
(service dovecot-service-type
(dovecot-configuration
+ (extensions (list dovecot-pigeonhole))
(disable-plaintext-auth? #f)
+ ;; Required for sieve!
+ (postmaster-address "postmaster@komputilo")
(ssl? "no")
(auth-mechanisms '("anonymous"))
(auth-anonymous-username "alice")
+ (protocols
+ (list (protocol-configuration
+ (name "imap")
+ (mail-plugins '("$mail_plugins" "imap_sieve"))
+ (imap-metadata? #t))))
+
+ (plugin-configuration
+ (plugin-configuration
+ (entries (list
+ (cons 'sieve-global "/tmp")
+ (cons 'sieve-extensions "+editheader")
+
+ (cons 'imapsieve-mailbox1-name "*")
+ (cons 'imapsieve-mailbox1-causes "APPEND")
+ ;; Run the script *before* the user scripts
+ (cons 'imapsieve-mailbox1-before "file:/tmp/main.sieve")
+ ;; We want to automatically remove original email
+ (cons 'imapsieve-expunge-discarded "yes")
+
+ (cons 'sieve-trace-debug "yes")
+ (cons 'sieve-trace-dir "/tmp")
+ (cons 'sieve-trace-level "tests")
+ (cons 'sieve-plugins "sieve_imapsieve")
+ ;; You cannot run scripts anywhere you want
+ ;; Sieve allows you to only run scripts under
+ ;; sieve_pipe_bin_dir.
+ (cons 'sieve-pipe-bin-dir "/tmp")
+ ))))
+
(mail-location
(string-append "maildir:~/Maildir"
":INBOX=~/Maildir/INBOX"
@@ -334,6 +366,18 @@ (define* (message-length message #:key (encoding "iso-8859-1"))
(define message "From: test@example.com\n\
Subject: Hello Nice to meet you!")
+ (define sieve-script
+ "require \"editheader\";\n
+addheader \"X-Sieve-Filtered\" \"Guix\";
+")
+ ;; Install our sieve script
+ (marionette-eval
+ `(begin
+ (with-output-to-file "/tmp/main.sieve"
+ (lambda ()
+ (display ,sieve-script))))
+ marionette)
+
(test-runner-current (system-test-runner #$output))
(test-begin "dovecot")
@@ -367,6 +411,19 @@ (define message "From: test@example.com\n\
;; Create a TESTBOX mailbox
(write-line "a CREATE TESTBOX" imap)
(read-line imap) ;OK
+ ;; Select mailbox. This is required so that dovecot did
+ ;; synchronization correctly.
+ (write-line "a SELECT TESTBOX" imap)
+ ;; ("* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r")
+ ;; ("* OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\*)] Flags permitted.\r")
+ ;; ("* 1 EXISTS\r")
+ ;; ("* 1 RECENT\r")
+ ;; ("* OK [UNSEEN 1] First unseen.\r")
+ ;; ("* OK [UIDVALIDITY 1732177859] UIDs valid\r")
+ ;; ("* OK [UIDNEXT 3] Predicted next UID\r")
+ (for-each (lambda (n)
+ (read-line imap))
+ (iota 7))
;; Append a message to a TESTBOX mailbox
(write-line (format #f "a APPEND TESTBOX {~a}"
(number->string (message-length message)))
@@ -380,18 +437,18 @@ (define message "From: test@example.com\n\
#t))
(test-equal "mail arrived"
- message
+ (string-join (list "X-Sieve-Filtered: Guix" message) "\n")
(marionette-eval
'(begin
(use-modules (ice-9 ftw)
(ice-9 match)
(rnrs io ports))
-
- (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/"))
- (match (scandir TESTBOX/new)
+ ;; XXX: We expect a new email in /cur directory
+ (let ((TESTBOX/cur "/home/alice/Maildir/TESTBOX/cur/"))
+ (match (scandir TESTBOX/cur)
(("." ".." message-file)
(call-with-input-file
- (string-append TESTBOX/new message-file)
+ (string-append TESTBOX/cur message-file)
get-string-all)))))
marionette))
--
2.46.0
S
S
Simon Streit wrote on 26 Nov 10:58 +0100
Re: [bug#42899] [PATCH v6 0/3] services: dovecot: Add pigeonhole support
(name . Alexey Abramov via Guix-patches via)(address . guix-patches@gnu.org)
ygu7c8qmi3p.fsf@netpanic.org
Hello Alexey,

Alexey Abramov via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (8 lines)
> - I changed the location of modules to /usr/lib/dovecot instead of
> /etc/dovecot. Don't know why). /usr/lib/dovecot seems natural to me.
> - I renamed `%dovecot-moduledir' to make-dovecot-moduledir, and now use
> union-build to create the union of modules.
> - %dovecot-activation uses switch-symlinks now.
> - I changed the tests a little bit, so that email will go through a simple
> sieve script.

I applied the patches and got it working too.


Kind regards

--
Simon
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 42899@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 42899
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch