dotfiles/modules/nixos/services/arr.nix

101 lines
2.7 KiB
Nix
Raw Normal View History

2023-06-04 14:19:56 +00:00
{ config, lib, ... }: {
2023-03-12 13:24:16 +00:00
options = {
arrServer = lib.mkOption {
2023-03-12 21:07:54 +00:00
type = lib.types.nullOr lib.types.str;
2023-03-12 13:24:16 +00:00
description = "Hostname for arr services";
default = null;
};
};
config = lib.mkIf (config.arrServer != null) {
services.sonarr.enable = true;
services.radarr.enable = true;
services.bazarr.enable = true;
services.prowlarr.enable = true;
2023-06-03 23:00:18 +00:00
services.sabnzbd.enable = true;
2023-06-04 14:19:56 +00:00
services.sabnzbd.configFile = "/data/downloads/sabnzbd/sabnzbd.ini";
2023-06-04 01:10:23 +00:00
services.jellyseerr.enable = true;
2023-06-03 23:00:18 +00:00
unfreePackages = [ "unrar" ]; # Required for sabnzbd
2023-03-12 13:24:16 +00:00
# Grant users access to destination directories
2023-06-04 14:19:56 +00:00
users.users.sonarr.extraGroups = [ "jellyfin" "sabnzbd" ];
users.users.radarr.extraGroups = [ "jellyfin" "sabnzbd" ];
users.users.bazarr.extraGroups = [ "jellyfin" "sabnzbd" ];
users.users.sabnzbd.homeMode = "0770";
users.users.${config.user}.extraGroups = [ "sabnzbd" ];
users.users.jellyfin.extraGroups = [ "sonarr" "radarr" ];
2023-03-12 13:24:16 +00:00
# Requires updating the base_url config value in each service
# If you try to rewrite the URL, the service won't redirect properly
caddy.routes = [
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/sonarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8989"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/radarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:7878"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/prowlarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:9696"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/bazarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:6767"; }];
}];
}
2023-06-03 23:00:18 +00:00
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/sabnzbd*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8085"; }];
}];
}
2023-06-04 01:10:23 +00:00
{
group = "download";
match = [{ host = [ config.arrServer ]; }];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:5055"; }];
}];
}
2023-03-12 13:24:16 +00:00
];
};
}