From 2335cb65a393b45949b18fb484eee1d2a09e5252 Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Sat, 3 Jul 2010 15:10:48 +0000 Subject: [PATCH] Added sabnzbd :) SABnzbd makes Usenet as simple and streamlined as possible by automating everything we can. All you have to do is add an .nzb. SABnzbd takes over from there, where it will be automatically downloaded, verified, repaired, extracted and filed away with zero human interaction. http://sabnzbd.org/ svn path=/nixos/trunk/; revision=22446 --- modules/misc/ids.nix | 1 + modules/module-list.nix | 1 + modules/services/networking/sabnzbd.nix | 52 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 modules/services/networking/sabnzbd.nix 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}"; + }; + + }; +}