forked from mirrors/nixpkgs
teamspeak-server module: Create data directory by
leveraging users.users.<user>.createHome instead of a preStart script. preStart script is still required to ensure proper creation of logging directory.
This commit is contained in:
parent
b874447eef
commit
11b0972544
|
@ -16,7 +16,6 @@ in
|
|||
options = {
|
||||
|
||||
services.teamspeak3 = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -96,17 +95,17 @@ in
|
|||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.extraUsers.teamspeak =
|
||||
{ name = "teamspeak";
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
users.users.teamspeak = {
|
||||
description = "Teamspeak3 voice communication server daemon";
|
||||
group = group;
|
||||
uid = config.ids.uids.teamspeak;
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
users.extraGroups.teamspeak =
|
||||
{ name = "teamspeak";
|
||||
users.groups.teamspeak = {
|
||||
gid = config.ids.gids.teamspeak;
|
||||
};
|
||||
|
||||
|
@ -116,14 +115,12 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -p ${cfg.dataDir}
|
||||
mkdir -p ${cfg.logPath}
|
||||
chown ${user}:${group} ${cfg.dataDir}
|
||||
chown ${user}:${group} ${cfg.logPath}
|
||||
'';
|
||||
|
||||
serviceConfig =
|
||||
{ ExecStart = ''
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${ts3}/bin/ts3server \
|
||||
dbsqlpath=${ts3}/lib/teamspeak/sql/ logpath=${cfg.logPath} \
|
||||
voice_ip=${cfg.voiceIP} default_voice_port=${toString cfg.defaultVoicePort} \
|
||||
|
@ -133,10 +130,12 @@ in
|
|||
WorkingDirectory = cfg.dataDir;
|
||||
User = user;
|
||||
Group = group;
|
||||
PermissionsStartOnly = true; # preStart needs to run with root permissions
|
||||
PermissionsStartOnly = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [ arobyn ];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue