{ config, lib, ... }: with lib; let cfg = config.local.web.sites.portal; inherit (config.local) domains; in { options.local.web.sites.portal = { enable = mkEnableOption "public non-fqdn portal"; }; config = mkIf cfg.enable { local.web = { enable = mkDefault true; ownedCerts = [ "host" ]; defaultACMEHost = domains.host.main; }; services.nginx.virtualHosts.${domains.host.www} = { forceSSL = true; useACMEHost = domains.host.main; serverAliases = [ domains.host.main ]; }; }; }