1 { config, lib, options, pkgs, ... }:
9 cfg = config.services.sickbeard;
10 opt = options.services.sickbeard;
11 sickbeard = cfg.package;
19 services.sickbeard = {
23 description = "Whether to enable the sickbeard server.";
25 package = mkPackageOption pkgs "sickbeard" {
28 Enable `pkgs.sickrage` or `pkgs.sickgear`
29 as an alternative to SickBeard
34 default = "/var/lib/${name}";
35 description = "Path where to store data files.";
37 configFile = mkOption {
39 default = "${cfg.dataDir}/config.ini";
40 defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
41 description = "Path to config file.";
44 type = types.ints.u16;
46 description = "Port to bind to.";
51 description = "User to run the service as";
56 description = "Group to run the service as";
64 config = mkIf cfg.enable {
66 users.users = optionalAttrs (cfg.user == name) {
68 uid = config.ids.uids.sickbeard;
70 description = "sickbeard user";
76 users.groups = optionalAttrs (cfg.group == name) {
77 ${name}.gid = config.ids.gids.sickbeard;
80 systemd.services.sickbeard = {
81 description = "Sickbeard Server";
82 wantedBy = [ "multi-user.target" ];
83 after = [ "network.target" ];
88 ExecStart = "${sickbeard}/bin/${sickbeard.pname} --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port}";