{homepage, ...}: let domain1 = "sondell.org"; domain2 = "start.sondell.org"; port = "8118"; hostSettings = { locations."/" = { proxyPass = "http://localhost:${port}/"; proxyWebsockets = true; }; }; in { systemd.services.homepage = { enable = true; description = "homepage with links to selfhosted services"; wantedBy = ["multi-user.target"]; unitConfig = { After = "network-online.target"; }; serviceConfig = { ExecStart = "${homepage}/bin/home-prod -p ${port}"; User = "sondell"; Type = "simple"; }; }; services.nginx.virtualHosts.${domain1} = hostSettings; services.nginx.virtualHosts.${domain2} = hostSettings; }