{ config, ... }: let my = config.my; port = 8080; in { services.keycloak = { enable = true; initialAdminPassword = "changemeasap"; database.createLocally = true; database.passwordFile = config.age.secrets.keycloakDatabasePasswordFile.path; frontendUrl = "https://auth.${my.subZone}/auth/"; forceBackendUrlToFrontendUrl = true; httpPort = toString port; extraConfig = { "subsystem=undertow"."server=default-server"."http-listener=default".proxy-address-forwarding = true; }; }; services.nginx.virtualHosts."auth.${my.subZone}" = { forceSSL = true; enableACME = true; locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; }; }