dotfiles/modules/nixos/services/arr.nix

106 lines
2.5 KiB
Nix
Raw Normal View History

2023-06-04 14:19:56 +00:00
{ config, lib, ... }: {
2023-03-12 13:24:16 +00:00
2023-07-07 16:16:07 +00:00
options = { arrs.enable = lib.mkEnableOption "Arr services"; };
2023-03-12 13:24:16 +00:00
config = lib.mkIf config.arrs.enable {
2023-03-12 13:24:16 +00:00
2023-06-06 00:56:52 +00:00
services = {
bazarr = {
enable = true;
group = "media";
};
jellyseerr.enable = true;
prowlarr.enable = true;
sabnzbd = {
enable = true;
group = "media";
configFile = "/data/downloads/sabnzbd/sabnzbd.ini";
};
sonarr = {
enable = true;
group = "media";
};
radarr = {
enable = true;
group = "media";
};
};
2023-03-12 13:24:16 +00:00
2023-06-06 00:56:52 +00:00
users.groups.media = { };
users.users.${config.user}.extraGroups = [ "media" ];
2023-06-04 14:19:56 +00:00
users.users.sabnzbd.homeMode = "0770";
2023-06-06 00:56:52 +00:00
unfreePackages = [ "unrar" ]; # Required for sabnzbd
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 = [{
2023-07-07 16:16:07 +00:00
host = [ config.hostnames.download ];
2023-03-12 13:24:16 +00:00
path = [ "/sonarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8989"; }];
}];
}
{
group = "download";
match = [{
2023-07-07 16:16:07 +00:00
host = [ config.hostnames.download ];
2023-03-12 13:24:16 +00:00
path = [ "/radarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:7878"; }];
}];
}
{
group = "download";
match = [{
2023-07-07 16:16:07 +00:00
host = [ config.hostnames.download ];
2023-03-12 13:24:16 +00:00
path = [ "/prowlarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:9696"; }];
}];
}
{
group = "download";
match = [{
2023-07-07 16:16:07 +00:00
host = [ config.hostnames.download ];
2023-03-12 13:24:16 +00:00
path = [ "/bazarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:6767"; }];
}];
}
2023-06-03 23:00:18 +00:00
{
group = "download";
match = [{
2023-07-07 16:16:07 +00:00
host = [ config.hostnames.download ];
2023-06-03 23:00:18 +00:00
path = [ "/sabnzbd*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8085"; }];
}];
}
2023-06-04 01:10:23 +00:00
{
group = "download";
2023-07-07 16:16:07 +00:00
match = [{ host = [ config.hostnames.download ]; }];
2023-06-04 01:10:23 +00:00
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:5055"; }];
}];
}
2023-03-12 13:24:16 +00:00
];
};
}