mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 05:29:20 +03:00
Sane default configuration for sabnzbd module
Added option to set user. Use unpriviledged user by default. Add sane default for configuration location.
This commit is contained in:
parent
7556fe4cf6
commit
a6ebccfbb8
2 changed files with 29 additions and 12 deletions
|
@ -411,6 +411,7 @@
|
||||||
lambdabot = 191;
|
lambdabot = 191;
|
||||||
#asterisk = 192; # unused
|
#asterisk = 192; # unused
|
||||||
plex = 193;
|
plex = 193;
|
||||||
|
sabnzbd = 194;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing
|
# When adding a gid, make sure it doesn't match an existing
|
||||||
# uid. Users and groups with the same name should have equal
|
# uid. Users and groups with the same name should have equal
|
||||||
|
|
|
@ -17,11 +17,21 @@ in
|
||||||
services.sabnzbd = {
|
services.sabnzbd = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to enable the sabnzbd FTP server.";
|
description = "Whether to enable the sabnzbd server.";
|
||||||
};
|
};
|
||||||
configFile = mkOption {
|
configFile = mkOption {
|
||||||
default = "/var/sabnzbd/sabnzbd.ini";
|
default = "/var/lib/sabnzbd/sabnzbd.ini";
|
||||||
description = "Path to config file. (You need to create this file yourself!)";
|
description = "Path to config file.";
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
default = "sabnzbd";
|
||||||
|
description = "User to run the service as";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
default = "sabnzbd";
|
||||||
|
description = "Group to run the service as";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -31,23 +41,29 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
users.extraUsers =
|
users.extraUsers.sabnzbd = {
|
||||||
[ { name = "sabnzbd";
|
|
||||||
uid = config.ids.uids.sabnzbd;
|
uid = config.ids.uids.sabnzbd;
|
||||||
|
group = "sabnzbd";
|
||||||
description = "sabnzbd user";
|
description = "sabnzbd user";
|
||||||
home = "/homeless-shelter";
|
home = "/var/lib/sabnzbd/";
|
||||||
}
|
createHome = true;
|
||||||
];
|
};
|
||||||
|
|
||||||
systemd.services.sabnzbd =
|
users.extraGroups.sabnzbd = {
|
||||||
{ description = "sabnzbd server";
|
gid = config.ids.gids.sabnzbd;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.sabnzbd = {
|
||||||
|
description = "sabnzbd server";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
|
GuessMainPID = "no";
|
||||||
|
User = "${cfg.user}";
|
||||||
|
Group = "${cfg.group}";
|
||||||
ExecStart = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}";
|
ExecStart = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue