diff options
| author | Jonathan Brielmaier <jonathan.brielmaier@web.de> | 2020-12-05 01:09:13 +0100 |
|---|---|---|
| committer | Jonathan Brielmaier <jonathan.brielmaier@web.de> | 2020-12-27 19:32:09 +0100 |
| commit | b4db11364185e035de3d8c335b1a66eddeeeb84c (patch) | |
| tree | 88c11ae633cfcf4065f864834e12404a873564da | |
| parent | 25aac383865b1139336aca923a4d436704c74a8c (diff) | |
services: Add radicale-service-type.
* gnu/services/mail.scm (radicale-configuration)
(radicale-configuration?): New procedures.
(%default-radicale-config-file)
(radicale-service-type): New variables.
* doc/guix.texi: Document it.
| -rw-r--r-- | doc/guix.texi | 25 | ||||
| -rw-r--r-- | gnu/services/mail.scm | 81 |
2 files changed, 105 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 6c681494a27..1081ed26a38 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -85,6 +85,7 @@ Copyright @copyright{} 2020 Alexandru-Sergiu Marton@* | |||
| 85 | Copyright @copyright{} 2020 raingloom@* | 85 | Copyright @copyright{} 2020 raingloom@* |
| 86 | Copyright @copyright{} 2020 Daniel Brooks@* | 86 | Copyright @copyright{} 2020 Daniel Brooks@* |
| 87 | Copyright @copyright{} 2020 John Soo@* | 87 | Copyright @copyright{} 2020 John Soo@* |
| 88 | Copyright @copyright{} 2020 Jonathan Brielmaier@* | ||
| 88 | 89 | ||
| 89 | Permission is granted to copy, distribute and/or modify this document | 90 | Permission is granted to copy, distribute and/or modify this document |
| 90 | under the terms of the GNU Free Documentation License, Version 1.3 or | 91 | under the terms of the GNU Free Documentation License, Version 1.3 or |
| @@ -21217,6 +21218,30 @@ Mailutils Manual}, for details. | |||
| 21217 | @end table | 21218 | @end table |
| 21218 | @end deftp | 21219 | @end deftp |
| 21219 | 21220 | ||
| 21221 | @subsubheading Radicale Service | ||
| 21222 | @cindex CalDAV | ||
| 21223 | @cindex CardDAV | ||
| 21224 | |||
| 21225 | @deffn {Scheme Variable} radicale-service-type | ||
| 21226 | This is the type of the @uref{https://radicale.org, Radicale} CalDAV/CardDAV | ||
| 21227 | server whose value should be a @code{radicale-configuration}. | ||
| 21228 | @end deffn | ||
| 21229 | |||
| 21230 | @deftp {Data Type} radicale-configuration | ||
| 21231 | Data type representing the configuration of @command{radicale}. | ||
| 21232 | |||
| 21233 | @table @asis | ||
| 21234 | @item @code{package} (default: @code{radicale}) | ||
| 21235 | The package that provides @command{radicale}. | ||
| 21236 | |||
| 21237 | @item @code{config-file} (default: @code{%default-radicale-config-file}) | ||
| 21238 | File-like object of the configuration file to use, by default it will listen | ||
| 21239 | on TCP port 5232 of @code{localhost} and use the @code{htpasswd} file at | ||
| 21240 | @file{/var/lib/radicale/users} with no (@code{plain}) encryption. | ||
| 21241 | |||
| 21242 | @end table | ||
| 21243 | @end deftp | ||
| 21244 | |||
| 21220 | @node Messaging Services | 21245 | @node Messaging Services |
| 21221 | @subsection Messaging Services | 21246 | @subsection Messaging Services |
| 21222 | 21247 | ||
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index 71fa975b5dc..c0f63711040 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au> | 4 | ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au> |
| 5 | ;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr> | 5 | ;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
| 6 | ;;; Copyright © 2019 Kristofer Buffington <kristoferbuffington@gmail.com> | 6 | ;;; Copyright © 2019 Kristofer Buffington <kristoferbuffington@gmail.com> |
| 7 | ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de> | ||
| 7 | ;;; | 8 | ;;; |
| 8 | ;;; This file is part of GNU Guix. | 9 | ;;; This file is part of GNU Guix. |
| 9 | ;;; | 10 | ;;; |
| @@ -31,6 +32,7 @@ | |||
| 31 | #:use-module (gnu system shadow) | 32 | #:use-module (gnu system shadow) |
| 32 | #:use-module (gnu packages mail) | 33 | #:use-module (gnu packages mail) |
| 33 | #:use-module (gnu packages admin) | 34 | #:use-module (gnu packages admin) |
| 35 | #:use-module (gnu packages dav) | ||
| 34 | #:use-module (gnu packages tls) | 36 | #:use-module (gnu packages tls) |
| 35 | #:use-module (guix records) | 37 | #:use-module (guix records) |
| 36 | #:use-module (guix packages) | 38 | #:use-module (guix packages) |
| @@ -70,7 +72,12 @@ | |||
| 70 | imap4d-configuration | 72 | imap4d-configuration |
| 71 | imap4d-configuration? | 73 | imap4d-configuration? |
| 72 | imap4d-service-type | 74 | imap4d-service-type |
| 73 | %default-imap4d-config-file)) | 75 | %default-imap4d-config-file |
| 76 | |||
| 77 | radicale-configuration | ||
| 78 | radicale-configuration? | ||
| 79 | radicale-service-type | ||
| 80 | %default-radicale-config-file)) | ||
| 74 | 81 | ||
| 75 | ;;; Commentary: | 82 | ;;; Commentary: |
| 76 | ;;; | 83 | ;;; |
| @@ -1834,3 +1841,75 @@ exim_group = exim | |||
| 1834 | (list (service-extension | 1841 | (list (service-extension |
| 1835 | shepherd-root-service-type imap4d-shepherd-service))) | 1842 | shepherd-root-service-type imap4d-shepherd-service))) |
| 1836 | (default-value (imap4d-configuration)))) | 1843 | (default-value (imap4d-configuration)))) |
| 1844 | |||
| 1845 | |||
| 1846 | ;;; | ||
| 1847 | ;;; Radicale. | ||
| 1848 | ;;; | ||
| 1849 | |||
| 1850 | (define-record-type* <radicale-configuration> | ||
| 1851 | radicale-configuration make-radicale-configuration | ||
| 1852 | radicale-configuration? | ||
| 1853 | (package radicale-configuration-package | ||
| 1854 | (default radicale)) | ||
| 1855 | (config-file radicale-configuration-config-file | ||
| 1856 | (default %default-radicale-config-file))) | ||
| 1857 | |||
| 1858 | (define %default-radicale-config-file | ||
| 1859 | (plain-file "radicale.conf" " | ||
| 1860 | [auth] | ||
| 1861 | type = htpasswd | ||
| 1862 | htpasswd_filename = /var/lib/radicale/users | ||
| 1863 | htpasswd_encryption = plain | ||
| 1864 | |||
| 1865 | [server] | ||
| 1866 | hosts = localhost:5232")) | ||
| 1867 | |||
| 1868 | (define %radicale-accounts | ||
| 1869 | (list (user-group | ||
| 1870 | (name "radicale") | ||
| 1871 | (system? #t)) | ||
| 1872 | (user-account | ||
| 1873 | (name "radicale") | ||
| 1874 | (group "radicale") | ||
| 1875 | (system? #t) | ||
| 1876 | (comment "Radicale Daemon") | ||
| 1877 | (home-directory "/var/empty") | ||
| 1878 | (shell (file-append shadow "/sbin/nologin"))))) | ||
| 1879 | |||
| 1880 | (define radicale-shepherd-service | ||
| 1881 | (match-lambda | ||
| 1882 | (($ <radicale-configuration> package config-file) | ||
| 1883 | (list (shepherd-service | ||
| 1884 | (provision '(radicale)) | ||
| 1885 | (documentation "Run the radicale daemon.") | ||
| 1886 | (requirement '(networking)) | ||
| 1887 | (start #~(make-forkexec-constructor | ||
| 1888 | (list #$(file-append package "/bin/radicale") | ||
| 1889 | "-C" #$config-file) | ||
| 1890 | #:user "radicale" | ||
| 1891 | #:group "radicale")) | ||
| 1892 | (stop #~(make-kill-destructor))))))) | ||
| 1893 | |||
| 1894 | (define radicale-activation | ||
| 1895 | (match-lambda | ||
| 1896 | (($ <radicale-configuration> package config-file) | ||
| 1897 | (with-imported-modules '((guix build utils)) | ||
| 1898 | #~(begin | ||
| 1899 | (use-modules (guix build utils)) | ||
| 1900 | (let ((uid (passwd:uid (getpw "radicale"))) | ||
| 1901 | (gid (group:gid (getgr "radicale")))) | ||
| 1902 | (mkdir-p "/var/lib/radicale/collections") | ||
| 1903 | (chown "/var/lib/radicale" uid gid) | ||
| 1904 | (chown "/var/lib/radicale/collections" uid gid) | ||
| 1905 | (chmod "/var/lib/radicale" #o700))))))) | ||
| 1906 | |||
| 1907 | (define radicale-service-type | ||
| 1908 | (service-type | ||
| 1909 | (name 'radicale) | ||
| 1910 | (description "Run radicale, a small CalDAV and CardDAV server.") | ||
| 1911 | (extensions | ||
| 1912 | (list (service-extension shepherd-root-service-type radicale-shepherd-service) | ||
| 1913 | (service-extension account-service-type (const %radicale-accounts)) | ||
| 1914 | (service-extension activation-service-type radicale-activation))) | ||
| 1915 | (default-value (radicale-configuration)))) | ||
