Compare commits

...

2 Commits

Author SHA1 Message Date
Noah Masur
e6dbed2e17 enable caddy logfile 2023-03-12 13:24:25 +00:00
Noah Masur
86076f0844 add arr services 2023-03-12 13:24:16 +00:00
5 changed files with 86 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

@ -24,6 +24,16 @@
listen = [ ":443" ];
routes = config.caddy.routes;
errors.routes = config.caddy.blocks;
# logs = { }; # Uncomment to collect access logs
};
logging.logs.main = {
encoder = { format = "console"; };
writer = {
output = "file";
filename = "${config.services.caddy.logDir}/caddy.log";
roll = true;
};
level = "INFO";
};
});

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";