{ config, ... }: let cfg = config.pub-solar.paperless; nginxLocation = if cfg.path == "" then "/" else cfg.path; in { services.nginx = { enable = true; virtualHosts."${cfg.domain}" = { locations."${nginxLocation}" = { proxyPass = "http://127.0.0.1:8899"; proxyWebsockets = true; extraConfig = '' proxy_read_timeout 300s; proxy_set_header Host ${cfg.domain}; proxy_set_header X-Forwarded-For ''$remote_addr; ''; }; }; }; }