From 5060ee456c11e80fef4a9b9106974fb5f374a271 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 27 Sep 2015 15:35:42 +0200 Subject: [PATCH] nixos/taskserver: Unify taskd user and group The service doesn't start with the "taskd" user being present, so we really should add it. And while at it, it really makes sense to add a default group as well. I'm using a check for the user/group name as well, to allow the taskserver to be run as an existing user. Signed-off-by: aszlig --- nixos/modules/services/misc/taskserver.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nixos/modules/services/misc/taskserver.nix b/nixos/modules/services/misc/taskserver.nix index ea79fae99f3a..519b6bb30fd9 100644 --- a/nixos/modules/services/misc/taskserver.nix +++ b/nixos/modules/services/misc/taskserver.nix @@ -16,6 +16,11 @@ in { description = "User for taskserver."; }; + group = mkOption { + default = "taskd"; + description = "Group for taskserver."; + }; + dataDir = mkOption { default = "/var/lib/taskserver/data/"; description = "Data directory for taskserver."; @@ -183,6 +188,18 @@ in { environment.systemPackages = [ pkgs.taskserver ]; + users.users = optional (cfg.user == "taskd") { + name = "taskd"; + uid = config.ids.uids.taskd; + description = "Taskserver user"; + group = cfg.group; + }; + + users.groups = optional (cfg.group == "taskd") { + name = "taskd"; + gid = config.ids.gids.taskd; + }; + systemd.services.taskserver = { description = "taskserver Service."; path = [ pkgs.taskserver ]; @@ -223,6 +240,7 @@ in { ExecStart = "${pkgs.taskserver}/bin/taskdctl start"; ExecStop = "${pkgs.taskserver}/bin/taskdctl stop"; User = cfg.user; + Group = cfg.group; }; }; };