1 { config, lib, pkgs, ... }:
7 cfg = config.services.sabnzbd;
8 inherit (pkgs) sabnzbd;
18 enable = mkEnableOption (lib.mdDoc "the sabnzbd server");
22 default = pkgs.sabnzbd;
23 defaultText = "pkgs.sabnzbd";
24 description = lib.mdDoc "The sabnzbd executable package run by the service.";
27 configFile = mkOption {
29 default = "/var/lib/sabnzbd/sabnzbd.ini";
30 description = lib.mdDoc "Path to config file.";
36 description = lib.mdDoc "User to run the service as";
42 description = lib.mdDoc "Group to run the service as";
50 config = mkIf cfg.enable {
52 users.users.sabnzbd = {
53 uid = config.ids.uids.sabnzbd;
55 description = "sabnzbd user";
56 home = "/var/lib/sabnzbd/";
60 users.groups.sabnzbd = {
61 gid = config.ids.gids.sabnzbd;
64 systemd.services.sabnzbd = {
65 description = "sabnzbd server";
66 wantedBy = [ "multi-user.target" ];
67 after = [ "network.target" ];
72 Group = "${cfg.group}";
73 ExecStart = "${lib.getBin cfg.package}/bin/sabnzbd -d -f ${cfg.configFile}";