git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #7680 from stephenmw/master

nixos: sane default configuration for sabnzbd module

commit4c167f49023d33dd97698a7a1637a616ea2aaa8e authorEdward Tjörnhammar <ed@cflags.cc> dateTue 5 May 2015, 10:14 (12 years ago) parenteb0c751a6ebccf
2 files changed+29−12
nixos/modules/misc/ids.nix+1 nixos/modules/services/networking/sabnzbd.nix+28−12
nixos/modules/misc/ids.nix+1
@@ -411,6 +411,7 @@
411411 lambdabot = 191;
412412 #asterisk = 192; # unused
413413 plex = 193;
414+ sabnzbd = 194;
414415
415416 # When adding a gid, make sure it doesn't match an existing
416417 # uid. Users and groups with the same name should have equal
nixos/modules/services/networking/sabnzbd.nix+28−12
@@ -17,11 +17,21 @@ in
1717 services.sabnzbd = {
1818 enable = mkOption {
1919 default = false;
20− description = "Whether to enable the sabnzbd FTP server.";
20+ description = "Whether to enable the sabnzbd server.";
2121 };
2222 configFile = mkOption {
23− default = "/var/sabnzbd/sabnzbd.ini";
24− description = "Path to config file. (You need to create this file yourself!)";
23+ default = "/var/lib/sabnzbd/sabnzbd.ini";
24+ description = "Path to config file.";
25+ };
26+
27+ user = mkOption {
28+ default = "sabnzbd";
29+ description = "User to run the service as";
30+ };
31+
32+ group = mkOption {
33+ default = "sabnzbd";
34+ description = "Group to run the service as";
2535 };
2636 };
2737 };
@@ -31,23 +41,29 @@ in
3141
3242 config = mkIf cfg.enable {
3343
34− users.extraUsers =
35− [ { name = "sabnzbd";
44+ users.extraUsers.sabnzbd = {
3645 uid = config.ids.uids.sabnzbd;
46+ group = "sabnzbd";
3747 description = "sabnzbd user";
38− home = "/homeless-shelter";
39− }
40− ];
48+ home = "/var/lib/sabnzbd/";
49+ createHome = true;
50+ };
4151
42− systemd.services.sabnzbd =
43− { description = "sabnzbd server";
52+ users.extraGroups.sabnzbd = {
53+ gid = config.ids.gids.sabnzbd;
54+ };
55+
56+ systemd.services.sabnzbd = {
57+ description = "sabnzbd server";
4458 wantedBy = [ "multi-user.target" ];
4559 after = [ "network.target" ];
4660 serviceConfig = {
4761 Type = "forking";
62+ GuessMainPID = "no";
63+ User = "${cfg.user}";
64+ Group = "${cfg.group}";
4865 ExecStart = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}";
4966 };
50− };
51−
67+ };
5268 };
5369}