3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/networking/sabnzbd.nix
2014-09-22 12:09:53 +01:00

54 lines
1 KiB
Nix

{ config, lib, pkgs, ... }:
with 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";
}
];
systemd.services.sabnzbd =
{ description = "sabnzbd server";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "forking";
ExecStart = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}";
};
};
};
}