8 cfg = config.services.radarr;
14 enable = lib.mkEnableOption "Radarr, a UsetNet/BitTorrent movie downloader";
16 package = lib.mkPackageOption pkgs "radarr" { };
18 dataDir = lib.mkOption {
20 default = "/var/lib/radarr/.config/Radarr";
21 description = "The directory where Radarr stores its data files.";
24 openFirewall = lib.mkOption {
25 type = lib.types.bool;
27 description = "Open ports in the firewall for the Radarr web interface.";
33 description = "User account under which Radarr runs.";
36 group = lib.mkOption {
39 description = "Group under which Radarr runs.";
44 config = lib.mkIf cfg.enable {
45 systemd.tmpfiles.settings."10-radarr".${cfg.dataDir}.d = {
46 inherit (cfg) user group;
50 systemd.services.radarr = {
51 description = "Radarr";
52 after = [ "network.target" ];
53 wantedBy = [ "multi-user.target" ];
59 ExecStart = "${cfg.package}/bin/Radarr -nobrowser -data='${cfg.dataDir}'";
60 Restart = "on-failure";
64 networking.firewall = lib.mkIf cfg.openFirewall {
65 allowedTCPPorts = [ 7878 ];
68 users.users = lib.mkIf (cfg.user == "radarr") {
72 uid = config.ids.uids.radarr;
76 users.groups = lib.mkIf (cfg.group == "radarr") {
77 radarr.gid = config.ids.gids.radarr;