nixos/hqplayerd: remove configurable user/group
The service is adamant that it must run under the right user, so let's just enforce it.
This commit is contained in:
parent
3ccb633f85
commit
e242633669
1 changed files with 8 additions and 24 deletions
|
@ -56,22 +56,6 @@ in
|
||||||
Open TCP port 8088 in the firewall for the server.
|
Open TCP port 8088 in the firewall for the server.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "hqplayer";
|
|
||||||
description = ''
|
|
||||||
User account under which hqplayerd runs.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "hqplayer";
|
|
||||||
description = ''
|
|
||||||
Group account under which hqplayerd runs.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,9 +84,9 @@ in
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
tmpfiles.rules = [
|
tmpfiles.rules = [
|
||||||
"d ${configDir} 0755 ${cfg.user} ${cfg.group} - -"
|
"d ${configDir} 0755 hqplayer hqplayer - -"
|
||||||
"d ${stateDir} 0755 ${cfg.user} ${cfg.group} - -"
|
"d ${stateDir} 0755 hqplayer hqplayer - -"
|
||||||
"d ${stateDir}/home 0755 ${cfg.user} ${cfg.group} - -"
|
"d ${stateDir}/home 0755 hqplayer hqplayer - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
services.hqplayerd = {
|
services.hqplayerd = {
|
||||||
|
@ -130,8 +114,8 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkg}/bin/hqplayerd";
|
ExecStart = "${pkg}/bin/hqplayerd";
|
||||||
|
|
||||||
User = cfg.user;
|
User = "hqplayer";
|
||||||
Group = cfg.group;
|
Group = "hqplayer";
|
||||||
|
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = 5;
|
RestartSec = 5;
|
||||||
|
@ -145,15 +129,15 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups = mkIf (cfg.group == "hqplayer") {
|
users.groups = {
|
||||||
hqplayer.gid = config.ids.gids.hqplayer;
|
hqplayer.gid = config.ids.gids.hqplayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users = mkIf (cfg.user == "hqplayer") {
|
users.users = {
|
||||||
hqplayer = {
|
hqplayer = {
|
||||||
description = "hqplayer daemon user";
|
description = "hqplayer daemon user";
|
||||||
extraGroups = [ "audio" ];
|
extraGroups = [ "audio" ];
|
||||||
group = cfg.group;
|
group = "hqplayer";
|
||||||
uid = config.ids.uids.hqplayer;
|
uid = config.ids.uids.hqplayer;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue