From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id qJbWCHdEP2f9hQEAe85BDQ:P1 (envelope-from ) for ; Thu, 21 Nov 2024 14:32:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id qJbWCHdEP2f9hQEAe85BDQ (envelope-from ) for ; Thu, 21 Nov 2024 15:32:23 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=fpUIRVBo; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=ije43glt; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1732199543; a=rsa-sha256; cv=none; b=u1K3EfNn1bvDbRwlH9rRyTbhvhd5OCmLg+3ecOr9+myw1aF+rFqIu+0LAC1qR+p7YRKGLd H9nLyO5HauBPAZmYD4y+YKicxeVR+9/WoY7L3BglsLBcJfbQTSGzhO629CWO8HyRJhWVAD rzHqiuSIFLYit3UEt4YLhDXexuOhGhuymM/LWV7cF8WPettsSEqARjYatE9Bu9bdQbi3kC +sDOEzIUxbaxu7tKluSUD7/vyBFQC/4kgeOPyQknSZQvRM1yGUo9KCDHz5MCkzgBjOtu2H mfOSaXKKp+BKZ862Gj0n8bIYbVDFId0dTdHwaI/uLjnhttk+k6F85mRsU7c1aA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=fpUIRVBo; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=ije43glt; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1732199543; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=a5xHvB8njj3PuDKITpFarqQijFGIbRhMIn3757+/kTk=; b=j6CSZbFAf4VnE/8kMj8O5SKsmfnPPTm0Vty0+JALWriSFWCxtdayAgCexbA9v3lGQOUZ4Y ozeq0z/lh2rRP0RwxA/HjgtYzU+tUMOydu08Q6Tp9NGE46vJobkfdjmvKrso6l+56ZDC1V 4McLEyOZ6jvQ8mg1kHPzTkoam/Hn91vOtziYo6+ks5l+EiV5LTNMvWE8PkwH8q6cXxNIZC BeHg+Gs5yfVUMrv+Y68o8QQ9f11e8QXkkpwz9bFSD+v85pqukaXa1SuDU/F/FZOXAodITO U64xcTqyOBPqLDjU8n7SzkZphB1WcF9kbP0qtv2jXg0on72gFXzdiz78hyIGLQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D1B4D5872 for ; Thu, 21 Nov 2024 15:32:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6H7-0008BL-Ae; Thu, 21 Nov 2024 07:27:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE6H1-0008AR-Ot for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE6H1-00025Y-Ap for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=a5xHvB8njj3PuDKITpFarqQijFGIbRhMIn3757+/kTk=; b=fpUIRVBof2rkMKRXKKWVco51OZm7HBJOG5Dpyekhg+Mm0/AWnNsQUYtM9EGJWWi5N3hLSdEPzdF1FDbrGnlsTPYBeC01EWSr0BwVbTM78oO9HjlOXDGDIG1YTnQQPXabCznD0M74q8VsG7lGpSFYlkeAhPUYI0/ta8l3Hqbvh7KOYhlMjyfKNm16U6r3nWmNMKVdMRjHKmpQ6QTOIcMgq/o7HCpfbiLqIVudjmwxglZG+l30hlXdfXBBxx5ueSqeWg1uqH58LK4R5IL3D5cGojDV3ye5NyEixztRCgu2zWpALPwFYKRCj+prp/bzktMTCUzbpwDOHpYRAbB7zWFPoA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6H1-00088r-5T for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42899] [PATCH v6 2/3] services: dovecot: Provide plugins through a /gnu/store directory. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42899@debbugs.gnu.org Received: via spool by 42899-submit@debbugs.gnu.org id=B42899.173219197531207 (code B ref 42899); Thu, 21 Nov 2024 12:27:03 +0000 Received: (at 42899) by debbugs.gnu.org; 21 Nov 2024 12:26:15 +0000 Received: from localhost ([127.0.0.1]:49393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GF-00087B-0u for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:15 -0500 Received: from mail.mmer.org ([178.22.65.174]:58744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GB-00086V-8A for 42899@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:11 -0500 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 50b2e749 for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=Wa1UJgFcN2/VJ1aKCZESoFjiY VwR7HJcIggcPg9YXcs=; b=ije43gltcRSDbPPCQvviyUkqZTLbK7lJodcEB7/60 3vkQhq9bSyMrwrcakSZbbts0+RHKOZOi68T2/OEpMWqhQJhUsrPGNA9PtIiC0vIE hDckQ+8oWAD+3Jo4zGtKYWszLm2K2N8tXNG6AJ5t3qXAnlpFdcUr7ve4spwpTGgg UQ= Received: from delta (142-212-98-95.ftth.glasoperator.nl [95.98.212.142]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id ec9b634d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:25:59 +0000 (UTC) Date: Thu, 21 Nov 2024 12:25:57 +0000 Message-ID: <20241121122558.8617-3-levenson@mmer.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241121122558.8617-1-levenson@mmer.org> References: <20241121122558.8617-1-levenson@mmer.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches From: Alexey Abramov via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: D1B4D5872 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -2.85 X-Spam-Score: -2.85 X-TUID: TQYTRo6ik6Mq * 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(-) 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