{ config, lib, pkgs, ... }: let mkProxy = port: { forceSSL = true; enableACME = true; locations."/" = { proxyPass = "http://localhost:" + builtins.toString port + "/weechat"; proxyWebsockets = true; extraConfig = '' proxy_read_timeout 604800; # Prevent idle disconnects proxy_set_header X-Real-IP $remote_addr; # Let WeeChat see the client's IP ''; }; }; in { services.nginx.enable = true; services.nginx.virtualHosts."relayjq.isomorphis.me" = mkProxy 9001; }