2025-01-04 10:22:05 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2025-01-04 23:17:35 +00:00
|
|
|
nglib,
|
2025-01-04 10:22:05 +00:00
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.services.radarr;
|
2025-01-04 23:17:35 +00:00
|
|
|
cfgInit = config.init.services.radarr;
|
2025-01-04 10:22:05 +00:00
|
|
|
in {
|
|
|
|
options.services.radarr = {
|
|
|
|
enable = lib.mkEnableOption "radarr";
|
|
|
|
package = lib.mkPackageOption pkgs "radarr" {};
|
|
|
|
|
|
|
|
dataDir = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "/var/lib/radarr/.config/Radarr";
|
|
|
|
description = "The directory where Radarr stores its data files.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
init.services.radarr = {
|
|
|
|
enabled = true;
|
2025-01-04 23:17:35 +00:00
|
|
|
user = lib.mkDefault "radarr";
|
|
|
|
group = lib.mkDefault "radarr";
|
2025-01-04 10:22:05 +00:00
|
|
|
|
|
|
|
script = pkgs.writeShellScript "radarr-run.sh" ''
|
|
|
|
${lib.getExe cfg.package} -nobrowser -data='${cfg.dataDir}'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = [cfg.package];
|
2025-01-04 23:17:35 +00:00
|
|
|
|
|
|
|
users.users.${cfgInit.user} = nglib.mkDefaultRec {
|
|
|
|
description = "radarr";
|
|
|
|
group = cfgInit.group;
|
|
|
|
createHome = false;
|
|
|
|
home = "/var/empty";
|
|
|
|
useDefaultShell = true;
|
|
|
|
uid = config.ids.uids.radarr;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.${cfgInit.group} = nglib.mkDefaultRec {gid = config.ids.gids.radarr;};
|
2025-01-04 10:22:05 +00:00
|
|
|
};
|
|
|
|
}
|