add arr services

This commit is contained in:
Noah Masur 2023-03-12 13:24:16 +00:00
parent 2aea76c0e3
commit 86076f0844
4 changed files with 76 additions and 1 deletions

View File

@ -42,6 +42,7 @@ nixpkgs.lib.nixosSystem {
streamServer = "stream.masu.rs";
nextcloudServer = "cloud.masu.rs";
bookServer = "books.masu.rs";
arrServer = "download.masu.rs";
samba.enable = true;
backup.s3 = {

View File

@ -0,0 +1,71 @@
{ config, lib, ... }:
{
options = {
arrServer = lib.mkOption {
type = lib.types.str;
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;
# 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"; }];
}];
}
];
};
}

View File

@ -1,6 +1,7 @@
{ ... }: {
imports = [
./arr.nix
./backups.nix
./caddy.nix
./calibre.nix

View File

@ -41,7 +41,9 @@
};
# Create reverse proxy for web UI
caddy.routes = [{
caddy.routes = lib.mkAfter [{
group =
lib.mkIf (config.arrServer == config.transmissionServer) "download";
match = [{ host = [ config.transmissionServer ]; }];
handle = [{
handler = "reverse_proxy";