1 { config, lib, options, pkgs, ... }:
9 cfg = config.services.sickbeard;
10 opt = options.services.sickbeard;
11 sickbeard = cfg.package;
19 services.sickbeard = {
23 description = lib.mdDoc "Whether to enable the sickbeard server.";
27 default = pkgs.sickbeard;
28 defaultText = literalExpression "pkgs.sickbeard";
29 example = literalExpression "pkgs.sickrage";
30 description =lib.mdDoc ''
31 Enable `pkgs.sickrage` or `pkgs.sickgear`
32 as an alternative to SickBeard
37 default = "/var/lib/${name}";
38 description = lib.mdDoc "Path where to store data files.";
40 configFile = mkOption {
42 default = "${cfg.dataDir}/config.ini";
43 defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
44 description = lib.mdDoc "Path to config file.";
47 type = types.ints.u16;
49 description = lib.mdDoc "Port to bind to.";
54 description = lib.mdDoc "User to run the service as";
59 description = lib.mdDoc "Group to run the service as";
67 config = mkIf cfg.enable {
69 users.users = optionalAttrs (cfg.user == name) {
71 uid = config.ids.uids.sickbeard;
73 description = "sickbeard user";
79 users.groups = optionalAttrs (cfg.group == name) {
80 ${name}.gid = config.ids.gids.sickbeard;
83 systemd.services.sickbeard = {
84 description = "Sickbeard Server";
85 wantedBy = [ "multi-user.target" ];
86 after = [ "network.target" ];
91 ExecStart = "${sickbeard}/bin/${sickbeard.pname} --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port}";