summary refs log blame commit diff stats
path: root/system/services/keycloak/default.nix
blob: 5f21b904fb6270809d536d19fedec0a97aa2373f (plain) (tree)































                                                                                                    
                                                           









                                 
{config, ...}: {
  services.nginx = {
    enable = true;

    # enable recommended settings
    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedTlsSettings = true;
    recommendedProxySettings = true;

    virtualHosts = {
      "auth.vhack.eu" = {
        forceSSL = true;
        enableACME = true;
        locations = {
          "/" = {
            proxyPass = "http://localhost:${toString config.services.keycloak.settings.http-port}/";
          };
        };
      };
    };
  };

  services.postgresql.enable = true;

  services.keycloak = {
    enable = true;

    database = {
      type = "postgresql";
      createLocally = true;

      username = "keycloak";
      passwordFile = "${config.age.secrets.keycloak.path}";
    };

    settings = {
      hostname = "auth.vhack.eu";
      http-relative-path = "/";
      http-port = 38080;
      proxy = "passthrough";
      http-enabled = true;
    };
  };
}