nixos/prosody: add user, group options
This commit is contained in:
parent
9358f60f94
commit
d260e95cb9
|
@ -301,6 +301,18 @@ in
|
||||||
default = "/var/lib/prosody";
|
default = "/var/lib/prosody";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "prosody";
|
||||||
|
description = "User account under which prosody runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "prosody";
|
||||||
|
description = "Group account under which prosody runs.";
|
||||||
|
};
|
||||||
|
|
||||||
allowRegistration = mkOption {
|
allowRegistration = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -475,15 +487,15 @@ in
|
||||||
'') cfg.virtualHosts) }
|
'') cfg.virtualHosts) }
|
||||||
'';
|
'';
|
||||||
|
|
||||||
users.extraUsers.prosody = {
|
users.extraUsers.prosody = mkIf (cfg.user == "prosody") {
|
||||||
uid = config.ids.uids.prosody;
|
uid = config.ids.uids.prosody;
|
||||||
description = "Prosody user";
|
description = "Prosody user";
|
||||||
createHome = true;
|
createHome = true;
|
||||||
group = "prosody";
|
inherit (cfg) group;
|
||||||
home = "${cfg.dataDir}";
|
home = "${cfg.dataDir}";
|
||||||
};
|
};
|
||||||
|
|
||||||
users.extraGroups.prosody = {
|
users.extraGroups.prosody = mkIf (cfg.group == "prosody") {
|
||||||
gid = config.ids.gids.prosody;
|
gid = config.ids.gids.prosody;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -494,7 +506,8 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
restartTriggers = [ config.environment.etc."prosody/prosody.cfg.lua".source ];
|
restartTriggers = [ config.environment.etc."prosody/prosody.cfg.lua".source ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "prosody";
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
PIDFile = "${cfg.dataDir}/prosody.pid";
|
PIDFile = "${cfg.dataDir}/prosody.pid";
|
||||||
ExecStart = "${cfg.package}/bin/prosodyctl start";
|
ExecStart = "${cfg.package}/bin/prosodyctl start";
|
||||||
|
|
Loading…
Reference in a new issue