From ee051ad1033a5a92bfae42f06d6a0c8cdc57ef31 Mon Sep 17 00:00:00 2001 From: mc-fucker Date: Sat, 29 Apr 2023 20:33:25 +0200 Subject: [PATCH] added *arr stack --- modules/arrstack.nix | 133 +++++++++++++++++++++++++++++++++++++++++++ modules/vars.nix | 14 ++++- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 modules/arrstack.nix diff --git a/modules/arrstack.nix b/modules/arrstack.nix new file mode 100644 index 0000000..78d6523 --- /dev/null +++ b/modules/arrstack.nix @@ -0,0 +1,133 @@ +{ ... }: +let + cfg = import ./vars.nix; + radarr_port = cfg.arrstack.radarr.port; + sonarr_port = cfg.arrstack.sonarr.port; + sabnzbd_port = cfg.arrstack.sabnzbd.port; + domain = "mc-fucker.cool"; +in +{ + + #container config + virtualisation.oci-containers.containers.radarr = { + image = "lscr.io/linuxserver/radarr:latest"; + environment = { + TZ = "Europe/Berlin"; + }; + ports = [ + "${radarr_port}:7878" + ]; + volumes = [ + "/var/lib/radarr:/config" + "/mnt/arrstack:/data" + ]; + extraOptions = cfg.podman.extraOptions; + }; + + virtualisation.oci-containers.containers.sonarr = { + image = "lscr.io/linuxserver/sonarr:latest"; + environment = { + TZ = "Europe/Berlin"; + }; + ports = [ + "${sonarr_port}:8989" + ]; + volumes = [ + "/var/lib/sonarr:/config" + "/mnt/arrstack:/data" + ]; + extraOptions = cfg.podman.extraOptions; + }; + + + virtualisation.oci-containers.containers.sabnzbd = { + image = "lscr.io/linuxserver/sabnzbd:latest"; + environment = { + TZ = "Europe/Berlin"; + }; + ports = [ + "${sabnzbd_port}:8080" + ]; + volumes = [ + "/var/lib/sabnzbd:/config" + "/mnt/arrstack/usenet:/data/usenet" + ]; + extraOptions = cfg.podman.extraOptions; + }; + + #webserver config + imports = [ ./nginx.nix ]; + + services.nginx.virtualHosts = { + "radarr.${domain}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + proxyPass = "http://127.0.0.1:${radarr_port}"; + extraConfig = '' + #proxy_set_header Host $proxy_host; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_redirect off; + proxy_http_version 1.1; + access_log /var/log/nginx/radarr.${domain}_access.log; + error_log /var/log/nginx/radarr.${domain}_error.log; + ''; + }; + }; + }; + + "sonarr.${domain}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + proxyPass = "http://127.0.0.1:${sonarr_port}"; + extraConfig = '' + #proxy_set_header Host $proxy_host; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_redirect off; + proxy_http_version 1.1; + access_log /var/log/nginx/sonarr.${domain}_access.log; + error_log /var/log/nginx/sonarr.${domain}_error.log; + ''; + }; + }; + }; + + "sabnzbd.${domain}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + proxyPass = "http://127.0.0.1:${sabnzbd_port}"; + extraConfig = '' + # proxy_set_header Host $proxy_host; + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # proxy_set_header X-Forwarded-Host $host; + # proxy_set_header X-Forwarded-Proto $scheme; + # proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection $http_connection; + # proxy_redirect off; + # proxy_http_version 1.1; + access_log /var/log/nginx/sabnzbd.${domain}_access.log; + error_log /var/log/nginx/sabnzbd.${domain}_error.log; + ''; + }; + }; + }; + + }; + +} +# vim: set et ts=2 sw=2 ai: diff --git a/modules/vars.nix b/modules/vars.nix index 8814f24..897595c 100644 --- a/modules/vars.nix +++ b/modules/vars.nix @@ -1,9 +1,21 @@ { + arrstack = { + radarr = { + port = "7878"; + }; + sonarr = { + port = "8989"; + }; + sabnzbd = { + port = "9191"; + }; + }; + bookstack = { db = "bookstack"; domain = "docs.mc-fucker.cool"; - port = "8989"; + port = "8086"; }; ihatemoney = {