9 cfg = config.services.taskchampion-sync-server;
12 options.services.taskchampion-sync-server = {
13 enable = lib.mkEnableOption "TaskChampion Sync Server for Taskwarrior 3";
14 package = lib.mkPackageOption pkgs "taskchampion-sync-server" { };
16 description = "Unix User to run the server under";
18 default = "taskchampion";
20 group = lib.mkOption {
21 description = "Unix Group to run the server under";
23 default = "taskchampion";
26 description = "Port on which to serve";
30 openFirewall = lib.mkEnableOption "Open firewall port for taskchampion-sync-server";
31 dataDir = lib.mkOption {
32 description = "Directory in which to store data";
34 default = "/var/lib/taskchampion-sync-server";
37 versions = lib.mkOption {
38 description = "Target number of versions between snapshots";
39 type = types.ints.positive;
43 description = "Target number of days between snapshots";
44 type = types.ints.positive;
50 config = lib.mkIf cfg.enable {
51 users.users.${cfg.user} = {
55 users.groups.${cfg.group} = { };
56 networking.firewall.allowedTCPPorts = lib.mkIf (cfg.openFirewall) [ cfg.port ];
57 systemd.tmpfiles.settings = {
58 "10-taskchampion-sync-server" = {
61 inherit (cfg) group user;
68 systemd.services.taskchampion-sync-server = {
69 wantedBy = [ "multi-user.target" ];
70 after = [ "network.target" ];
76 ${lib.getExe cfg.package} \
77 --port ${builtins.toString cfg.port} \
78 --data-dir ${cfg.dataDir} \
79 --snapshot-versions ${builtins.toString cfg.snapshot.versions} \
80 --snapshot-days ${builtins.toString cfg.snapshot.days}