11 cfg = config.services.xandikos;
17 enable = mkEnableOption "Xandikos CalDAV and CardDAV server";
19 package = mkPackageOption pkgs "xandikos" { };
23 default = "localhost";
25 The IP address on which Xandikos will listen.
26 By default listens on localhost.
33 description = "The port of the Xandikos web application";
36 routePrefix = mkOption {
41 Useful when Xandikos is behind a reverse proxy.
45 extraOptions = mkOption {
47 type = types.listOf types.str;
48 example = literalExpression ''
51 "--current-user-principal user"
56 Extra command line arguments to pass to xandikos.
63 Configuration for nginx reverse proxy.
66 type = types.submodule {
72 Configure the nginx reverse proxy settings.
79 The hostname use to setup the virtualhost configuration
90 config = mkIf cfg.enable (mkMerge [
92 meta.maintainers = with lib.maintainers; [ _0x4A6F ];
94 systemd.services.xandikos = {
95 description = "A Simple Calendar and Contact Server";
96 after = [ "network.target" ];
97 wantedBy = [ "multi-user.target" ];
103 RuntimeDirectory = "xandikos";
104 StateDirectory = "xandikos";
105 StateDirectoryMode = "0700";
106 PrivateDevices = true;
108 CapabilityBoundingSet = "CAP_NET_RAW CAP_NET_ADMIN";
109 ProtectSystem = "strict";
112 ProtectKernelTunables = true;
113 ProtectKernelModules = true;
114 ProtectControlGroups = true;
115 RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX AF_PACKET AF_NETLINK";
116 RestrictNamespaces = true;
117 LockPersonality = true;
118 MemoryDenyWriteExecute = true;
119 RestrictRealtime = true;
120 RestrictSUIDSGID = true;
122 ${cfg.package}/bin/xandikos \
123 --directory /var/lib/xandikos \
124 --listen-address ${cfg.address} \
125 --port ${toString cfg.port} \
126 --route-prefix ${cfg.routePrefix} \
127 ${lib.concatStringsSep " " cfg.extraOptions}
133 (mkIf cfg.nginx.enable {
136 virtualHosts."${cfg.nginx.hostName}" = {
138 proxyPass = "http://${cfg.address}:${toString cfg.port}/";