{ config, lib, ... }: with lib; let cfg = config.local.web.sites.home; inherit (config.local) domains; in { options.local.web.sites.home = { enable = mkEnableOption "home site"; proxyUrl = mkOption { type = types.str; }; }; config = mkIf cfg.enable { local.web = { enable = mkDefault true; ownedCerts = [ "home" ]; }; services.nginx.virtualHosts.${domains.home.main} = { forceSSL = true; useACMEHost = domains.home.main; locations."/".extraConfig = '' proxy_pass ${cfg.proxyUrl}; proxy_redirect http:// https://; # Necesario debido a websockets proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; ''; }; }; }