diff --git a/hosts/common/server.nix b/hosts/common/server.nix index c292ec9..2531f4b 100644 --- a/hosts/common/server.nix +++ b/hosts/common/server.nix @@ -4,12 +4,9 @@ lib, pkgs, inputs, + options, ... }: { - imports = [ - inputs.configarr.nixosModules.default - ]; - boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; "net.bridge.bridge-nf-call-iptables" = 1; @@ -29,23 +26,23 @@ services.caddy = { enable = true; environmentFile = config.sops.templates."caddy.env".path; + virtualHosts."centraldogma.site:".extraConfig = '' - root /mnt/games/ - file_server browse + root /srv/root/ + + file_server encode zstd gzip redir /radarr /radarr/ reverse_proxy /radarr/* 127.0.0.1:7878 ''; - # virtualHosts."dogma.lan:".extraConfig = '' - # tls internal - # root * /srv/root/ - # file_server browse - # encode zstd gzip - # ''; - # + virtualHosts."http://dogma.lan:".extraConfig = '' + root * /srv/root/ + file_server browse + encode zstd gzip + ''; virtualHosts."jellyfin.centraldogma.site:".extraConfig = '' reverse_proxy /* 127.0.0.1:8096 ''; @@ -66,8 +63,81 @@ services.flaresolverr.enable = true; + sops.templates.configarr-ev = { + content = '' + LOG_LEVEL=debug + LOG_STACKTRACE=true + CONFIGARR_ENABLE_MERGE=true + RADARR_API_KEY=${config.sops.placeholder."radarr/apikey"} + SONARR_API_KEY=${config.sops.placeholder."sonarr/apikey"} + ''; + inherit (config.services.configarr) group; + owner = config.services.configarr.user; + }; + services.configarr = { + package = + options.services.configarr.package.default.overrideAttrs + (old: { + pnpmDeps = old.pnpmDeps.overrideAttrs (_: { + outputHash = "sha256-auz4JyfHJAOF+baLfV391HgBTua4AJFfX4CtTPh+0Sw="; + }); + }); enable = true; + config = + #yaml + '' + x-download-clients: + # Define an anchor for shared instance + qb_base: &qb_base + name: "qBit" + type: qbittorrent + enable: true + priority: 1 + remove_completed_downloads: true + remove_failed_downloads: true + # YAML does a shallow merge, thus we must declare another anchor for the nested dictionary if we plan to override values in it + fields: &qb_fields + host: qbittorrent + port: 8080 + use_ssl: false + username: admin + password: changeme + + radarr: + radarr_instance: + api_key: !env RADARR_API_KEY + base_url: http://localhost:${toString config.services.radarr.settings.server.port} + + sonarr: + sonarr_instance: + api_key: !env SONARR_API_KEY + base_url: http://localhost:${toString config.services.sonarr.settings.server.port} + download_clients: + data: + - <<: *qb_base + fields: + <<: *qb_fields + tv_category: series + tags: ["sonarr"] + # Reuse same base, override name and fields + - <<: *qb_base + name: "qBit 4K" + fields: + <<: *qb_fields + tv_category: series-4k + tags: ["4K"] + update_password: false + delete_unmanaged: + enabled: true + ignore: ["Manual Test Client"] + config: + enable_completed_download_handling: true + auto_redownload_failed: false + + + ''; + environmentFile = config.sops.templates."configarr-ev".path; }; services.mongodb = { @@ -76,6 +146,7 @@ initialRootPasswordFile = config.sops.secrets."mongodb/initial_password".path; }; services.jackett.enable = true; + services.prowlarr.enable = true; services.factorio = { enable = true; @@ -115,7 +186,7 @@ openRPCPort = true; settings = { rpc-bind-address = "0.0.0.0"; - rpc-whitelist = "127.0.0.1,192.168.1.86"; + rpc-whitelist = "127.0.0.1,192.168.0.91"; download-dir = "/mnt/media/Downloads"; }; };