2014-05-27 21:27:31 +01:00
|
|
|
{config, lib, pkgs, ...}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.radicale;
|
|
|
|
|
|
|
|
confFile = pkgs.writeText "radicale.conf" cfg.config;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.radicale.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Enable Radicale CalDAV and CardDAV server
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.radicale.config = mkOption {
|
|
|
|
type = types.string;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Radicale configuration, this will set the service
|
|
|
|
configuration file
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.pythonPackages.radicale ];
|
|
|
|
|
2016-03-20 14:25:02 +00:00
|
|
|
users.extraUsers = singleton
|
|
|
|
{ name = "radicale";
|
|
|
|
uid = config.ids.uids.radicale;
|
|
|
|
description = "radicale user";
|
|
|
|
home = "/var/lib/radicale";
|
|
|
|
createHome = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraGroups = singleton
|
|
|
|
{ name = "radicale";
|
|
|
|
gid = config.ids.gids.radicale;
|
|
|
|
};
|
|
|
|
|
2016-01-06 06:50:18 +00:00
|
|
|
systemd.services.radicale = {
|
2014-05-27 21:27:31 +01:00
|
|
|
description = "A Simple Calendar and Contact Server";
|
2016-01-06 06:50:18 +00:00
|
|
|
after = [ "network-interfaces.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2016-09-08 11:34:22 +01:00
|
|
|
script = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -f";
|
2016-03-20 14:25:02 +00:00
|
|
|
serviceConfig.User = "radicale";
|
|
|
|
serviceConfig.Group = "radicale";
|
2014-05-27 21:27:31 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|