From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uEkSHl3Uyl+OewAA0tVLHw (envelope-from ) for ; Sat, 05 Dec 2020 00:29:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MPLhGV3Uyl8aOQAA1q6Kng (envelope-from ) for ; Sat, 05 Dec 2020 00:29:17 +0000 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 0F6F1940111 for ; Sat, 5 Dec 2020 00:29:17 +0000 (UTC) Received: from localhost ([::1]:54620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klLRs-00024u-0P for larch@yhetil.org; Fri, 04 Dec 2020 19:29:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klLRf-0001yB-4f for guix-patches@gnu.org; Fri, 04 Dec 2020 19:29:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1klLRe-0005dm-U5 for guix-patches@gnu.org; Fri, 04 Dec 2020 19:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1klLRe-0001OU-R1 for guix-patches@gnu.org; Fri, 04 Dec 2020 19:29:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45047] [PATCH 2/2] services: Add radicale-service-type. Resent-From: Jonathan Brielmaier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 05 Dec 2020 00:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45047 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45047@debbugs.gnu.org Cc: Jonathan Brielmaier Received: via spool by 45047-submit@debbugs.gnu.org id=B45047.16071280945293 (code B ref 45047); Sat, 05 Dec 2020 00:29:02 +0000 Received: (at 45047) by debbugs.gnu.org; 5 Dec 2020 00:28:14 +0000 Received: from localhost ([127.0.0.1]:46200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klLQs-0001NJ-4H for submit@debbugs.gnu.org; Fri, 04 Dec 2020 19:28:14 -0500 Received: from mout.web.de ([212.227.15.14]:51101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klLQo-0001Mt-RT for 45047@debbugs.gnu.org; Fri, 04 Dec 2020 19:28:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1607128085; bh=EhCWpPF+eclj5hhf2qj9PUJKQ66Gxfy2+mrcVUOxtM4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=gGg89YPQ7O29ViPirdJhl46gMqEpRmFTgHKJdHcV9z1RXDAigQOaUoKajqs+30hGv 0g+bxh6FoCqySDOxi3HMyx5Nsdn/e8Lo3y6e+vHAb4ulh8HktM9Scm6v/JFaPa94oi jfTQbE0Gea755Xkdz2dGZBHKLgcXQ5qmr/cthtgE= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from 3700X.fritz.box ([88.152.184.82]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lk8Ow-1k9GrH0SL4-00c9fc; Sat, 05 Dec 2020 01:28:05 +0100 From: Jonathan Brielmaier Date: Sat, 5 Dec 2020 01:27:55 +0100 Message-Id: <20201205002755.23215-2-jonathan.brielmaier@web.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201205002755.23215-1-jonathan.brielmaier@web.de> References: <20201205002607.22785-1-jonathan.brielmaier@web.de> <20201205002755.23215-1-jonathan.brielmaier@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:UmwKrAirDtC0hd5JKj/bMzpMYYSmckww/JM61IDibNC19Cd55yj crqpUoxBmNvJnqjJqvXZKlmKQ4s74qpkd5vrM2+O7T6VcZNtE3wPhPePFxt1hRnX/6Tn0dp AB0Vdhtt4l28tejtndOaODSfOrpSYqWCrEpoUT2ot54jLRVIbPjZTRtTAokWGR3VLpaOIqS MVSJtl+5N9bqzLt6Emomw== X-UI-Out-Filterresults: notjunk:1;V03:K0:l1f3Pkp4Sv8=:0q7hxt8xRjonYAfMRC+ijn K5kt+np3ldm1JVlaJMQ6+1VRHsansmjKFIW/M2JuU3ZKAoYx9C+4hh0F13/PbSwb/m3aJNS/T aOR1ggpNsalX+/pKcWdXTVMcV4PtkIPvnuAPH7s1IRu+T41mMzUDF3hTs46ogw+CV8VB4O9I0 XEOZxyUzlZ89HLsKu0YWfAQNWCpdKPp7zn6U2F71Vqh5J02McrTeuHNqxKqiJlK2yoX7soyI4 RcfF15qFd+kBFbvCPJtMxwMqqww1HuHkkHAueOPC+csiZzF68jXtUI2QS7Wl/CRJod3CN+/1c 9XqWvjkYAqQ4Gi/7hls0RFHgpQ1ajAf+1M9z+gcCYvGZwzlGBRtDdFW5ixLJCVx48sDcehDge wMH3a4kldZ55LDKPlZ77UrvE+uAs2hwLQ6vHkr81jspPoRta85maF6WrU9W/qFdIyjXLr7DAS BgYL5lLiY/3PXCOA335draGzorIbr5+M9WI5bkfu3u5JE0MOT93XQY+V9mExaa9rV6QFhXHxP uWlViijcR2Rg7yWoO82NFUpmgejmmTu/3oxKWvhM+kyzMlrLbtsJ2oZ8FsmwsNWmSk/JUxPia N0dof85/kHWYrRcRbpF0q1Fe1MzhIwSNo2oxyQsN1wOt34kAIW8QCPLk+0n9Jy5xa9+buhlUY R7viiUPlxyEhfTOBzjyncVKpxdSnmJ7pnFeqSGuuVunGyiUGsVzP4lPVacUc3UANZpkd2jYGC gXo7FbQ7qphTGWTTbJQ+fJTUNpLIYKfoAx1AfdGX8eRS7Vy0xH4YgWrnwRT8uvTX4Zh0axmJU ug3nkiFiQvQwfyR+d6K5hYzHagWG8PW9EgxIy1WdiLLI6hPQ4qNOb1pNM3t0ERDAeC6FaMOaj mVtpHElVODoyMiScjVA/lof3uXDxC3ad18GmgjlKU= 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -0.19 Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=web.de header.s=dbaedf251592 header.b=gGg89YPQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=web.de (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 0F6F1940111 X-Spam-Score: -0.19 X-Migadu-Scanner: ns3122888.ip-94-23-21.eu X-TUID: uC25b9QO8ppe * gnu/services/mail.scm (radicale-configuration) (radicale-configuration?): New procedures. (%default-radicale-config-file) (radicale-service-type): New variables. * doc/guix.texi: Document it. =2D-- doc/guix.texi | 25 +++++++++++++ gnu/services/mail.scm | 81 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index a5c9779c86..38fd468ebf 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -85,6 +85,7 @@ Copyright @copyright{} 2020 Alexandru-Sergiu Marton@* Copyright @copyright{} 2020 raingloom@* Copyright @copyright{} 2020 Daniel Brooks@* Copyright @copyright{} 2020 John Soo@* +Copyright @copyright{} 2020 Jonathan Brielmaier@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -21150,6 +21151,30 @@ Mailutils Manual}, for details. @end table @end deftp +@subsubheading Radicale Service +@cindex CalDAV +@cindex CardDAV + +@deffn {Scheme Variable} radicale-service-type +This is the type of the @uref{https://radicale.org, Radicale} CalDAV/Card= DAV +server whose value should be a @code{radicale-configuration}. +@end deffn + +@deftp {Data Type} radicale-configuration +Data type representing the configuration of @command{radicale}. + +@table @asis +@item @code{package} (default: @code{radicale}) +The package that provides @command{radicale}. + +@item @code{config-file} (default: @code{%default-radicale-config-file}) +File-like object of the configuration file to use, by default it will lis= ten +on TCP port 5232 of @code{localhost} and use the @code{htpasswd} file at +@file{/var/lib/radicale/users} with no (@code{plain}) encryption. + +@end table +@end deftp + @node Messaging Services @subsection Messaging Services diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index 71fa975b5d..c0f6371104 100644 =2D-- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -4,6 +4,7 @@ ;;; Copyright =C2=A9 2017 Carlo Zancanaro ;;; Copyright =C2=A9 2017, 2020 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2019 Kristofer Buffington +;;; Copyright =C2=A9 2020 Jonathan Brielmaier ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,7 @@ #:use-module (gnu system shadow) #:use-module (gnu packages mail) #:use-module (gnu packages admin) + #:use-module (gnu packages dav) #:use-module (gnu packages tls) #:use-module (guix records) #:use-module (guix packages) @@ -70,7 +72,12 @@ imap4d-configuration imap4d-configuration? imap4d-service-type - %default-imap4d-config-file)) + %default-imap4d-config-file + + radicale-configuration + radicale-configuration? + radicale-service-type + %default-radicale-config-file)) ;;; Commentary: ;;; @@ -1834,3 +1841,75 @@ exim_group =3D exim (list (service-extension shepherd-root-service-type imap4d-shepherd-service))) (default-value (imap4d-configuration)))) + +=0C +;;; +;;; Radicale. +;;; + +(define-record-type* + radicale-configuration make-radicale-configuration + radicale-configuration? + (package radicale-configuration-package + (default radicale)) + (config-file radicale-configuration-config-file + (default %default-radicale-config-file))) + +(define %default-radicale-config-file + (plain-file "radicale.conf" " +[auth] +type =3D htpasswd +htpasswd_filename =3D /var/lib/radicale/users +htpasswd_encryption =3D plain + +[server] +hosts =3D localhost:5232")) + +(define %radicale-accounts + (list (user-group + (name "radicale") + (system? #t)) + (user-account + (name "radicale") + (group "radicale") + (system? #t) + (comment "Radicale Daemon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define radicale-shepherd-service + (match-lambda + (($ package config-file) + (list (shepherd-service + (provision '(radicale)) + (documentation "Run the radicale daemon.") + (requirement '(networking)) + (start #~(make-forkexec-constructor + (list #$(file-append package "/bin/radicale") + "-C" #$config-file) + #:user "radicale" + #:group "radicale")) + (stop #~(make-kill-destructor))))))) + +(define radicale-activation + (match-lambda + (($ package config-file) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (let ((uid (passwd:uid (getpw "radicale"))) + (gid (group:gid (getgr "radicale")))) + (mkdir-p "/var/lib/radicale/collections") + (chown "/var/lib/radicale" uid gid) + (chown "/var/lib/radicale/collections" uid gid) + (chmod "/var/lib/radicale" #o700))))))) + +(define radicale-service-type + (service-type + (name 'radicale) + (description "Run radicale, a small CalDAV and CardDAV server.") + (extensions + (list (service-extension shepherd-root-service-type radicale-shepherd= -service) + (service-extension account-service-type (const %radicale-accoun= ts)) + (service-extension activation-service-type radicale-activation)= )) + (default-value (radicale-configuration)))) =2D- 2.29.2