{ lib, pkgs, ... }: {
  services.nginx = {
    enable = true;
    recommendedBrotliSettings = true;
    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedZstdSettings = true;

    virtualHosts."seedbox.hoki-porgy.ts.net" = {
      listen = [
        { addr = "0.0.0.0"; port = 80; }
        { addr = "[::]"; port = 80; }
      ]; 
      serverAliases = ["seedbox"];

      locations = let commonProxy = port: {
        recommendedProxySettings = true;
        proxyWebsockets = true;
        proxyPass = "http://127.0.0.1:${toString port}";
      }; in {
        "^~ /prowlarr" = commonProxy 9696;
        "^~ /lidarr" = commonProxy 8686;
        "^~ /radarr" = commonProxy 7878;
        "^~ /sonarr" = commonProxy 8989;
        "^~ /bazarr" = commonProxy 6767;
        "/transmission" = commonProxy 9091;
        "/" = {
          root = ./www;
          index = "index.html";
        };
      };
    };
  };
}
