diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index c100ae73456..8d516946868 100644 --- a/modules/misc/ids.nix +++ b/modules/misc/ids.nix @@ -53,6 +53,7 @@ in davfs2 = 31; privoxy = 32; osgi = 34; + sabnzbd = 33; tor = 35; # When adding a uid, make sure it doesn't match an existing gid. diff --git a/modules/module-list.nix b/modules/module-list.nix index 2925f5a1809..841a6b11a5f 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -97,6 +97,7 @@ ./services/networking/ssh/sshd.nix ./services/networking/tftpd.nix ./services/networking/vsftpd.nix + ./services/networking/sabnzbd.nix ./services/networking/wicd.nix ./services/networking/wpa_supplicant.nix ./services/networking/xinetd.nix diff --git a/modules/services/networking/sabnzbd.nix b/modules/services/networking/sabnzbd.nix new file mode 100644 index 00000000000..7f87343cbb9 --- /dev/null +++ b/modules/services/networking/sabnzbd.nix @@ -0,0 +1,52 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.sabnzbd; + inherit (pkgs) sabnzbd; + +in + +{ + + ###### interface + + options = { + services.sabnzbd = { + enable = mkOption { + default = false; + description = "Whether to enable the sabnzbd FTP server."; + }; + configFile = mkOption { + default = "/var/sabnzbd/sabnzbd.ini"; + description = "Path to config file. (You need to create this file yourself!)"; + }; + }; + }; + + + ###### implementation + + config = mkIf cfg.enable { + + users.extraUsers = + [ { name = "sabnzbd"; + uid = config.ids.uids.sabnzbd; + description = "sabnzbd user"; + home = "/homeless-shelter"; + } + ]; + + jobs.sabnzbd = + { description = "sabnzbd server"; + + startOn = "network-interfaces/started"; + stopOn = "network-interfaces/stop"; + + exec = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}"; + }; + + }; +}