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 <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2015-09-27 15:35:42 +02:00
parent 743993f4be
commit 5060ee456c
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

@ -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;
};
};
};