2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2010-07-03 17:10:48 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2010-07-03 17:10:48 +02:00
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
let
|
2010-07-03 17:10:48 +02:00
|
|
|
|
|
|
|
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!)";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-07-03 17:10:48 +02:00
|
|
|
|
|
|
|
###### 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";
|
|
|
|
|
2010-07-13 16:45:44 +02:00
|
|
|
startOn = "started network-interfaces";
|
|
|
|
stopOn = "stopping network-interfaces";
|
2010-07-03 17:10:48 +02:00
|
|
|
|
|
|
|
exec = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|