summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/taskserver.nix
diff options
context:
space:
mode:
authormakefu <makefu@nixos.dev>2016-05-02 16:08:30 +0200
committermakefu <makefu@nixos.dev>2016-05-02 16:08:30 +0200
commit64aa4f6912fb7425d8063e5d143f59c43fb31b8f (patch)
tree07fe7c386d32bd5e1375a7d01f623cd357a1d09d /makefu/3modules/taskserver.nix
parent3f77b6c89f4a3a28d62e9117712481489ac56fa1 (diff)
parent6f4bc4b34c3cbac56f6a23740dca566980823990 (diff)
Merge branch 'master' of gum:stockholm
Diffstat (limited to 'makefu/3modules/taskserver.nix')
-rw-r--r--makefu/3modules/taskserver.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/makefu/3modules/taskserver.nix b/makefu/3modules/taskserver.nix
new file mode 100644
index 000000000..41247fff3
--- /dev/null
+++ b/makefu/3modules/taskserver.nix
@@ -0,0 +1,60 @@
+{ config, lib, pkgs, ... }:
+
+with config.krebs.lib;
+let
+ cfg = config.makefu.taskserver;
+
+ out = {
+ options.makefu.taskserver = api;
+ config = lib.mkIf cfg.enable imp;
+ };
+
+ api = {
+ enable = mkEnableOption "taskserver";
+
+ workingDir = mkOption {
+ type = types.str;
+ default = "/var/lib/taskserver";
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.taskserver;
+ };
+
+
+ };
+
+ imp = {
+ environment.systemPackages = [ cfg.package ];
+ systemd.services.taskserver = {
+ description = "taskd server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ restartIfChanged = true;
+ unitConfig = {
+ Documentation = "http://taskwarrior.org/docs/#taskd" ;
+ # https://taskwarrior.org/docs/taskserver/configure.html
+ ConditionPathExists = "${cfg.workingDir}/config";
+ };
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = "${cfg.package}/bin/taskd server --data ${cfg.workingDir}";
+ WorkingDirectory = cfg.workingDir;
+ PrivateTmp = true;
+ InaccessibleDirectories = "/home /boot /opt /mnt /media";
+ User = "taskd";
+ };
+ };
+
+ users.users.taskd = {
+ uid = genid "taskd";
+ home = cfg.workingDir;
+ createHome = true;
+ };
+ users.groups.taskd.gid = genid "taskd";
+ };
+
+in
+out
+