1{config, lib, pkgs, ...}:
2
3with lib;
4
5let
6
7 cfg = config.services.radicale;
8
9 confFile = pkgs.writeText "radicale.conf" cfg.config;
10
11in
12
13{
14
15 options = {
16
17 services.radicale.enable = mkOption {
18 type = types.bool;
19 default = false;
20 description = ''
21 Enable Radicale CalDAV and CardDAV server
22 '';
23 };
24
25 services.radicale.config = mkOption {
26 type = types.string;
27 default = "";
28 description = ''
29 Radicale configuration, this will set the service
30 configuration file
31 '';
32 };
33 };
34
35 config = mkIf cfg.enable {
36
37 environment.systemPackages = [ pkgs.pythonPackages.radicale ];
38
39 jobs.radicale = {
40 description = "A Simple Calendar and Contact Server";
41 startOn = "started network-interfaces";
42 exec = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d";
43 daemonType = "fork";
44 };
45
46 };
47
48}