diff --git a/nixos/modules/services/web-apps/keycloak.nix b/nixos/modules/services/web-apps/keycloak.nix index 26bed24eed27..172a3e59335f 100644 --- a/nixos/modules/services/web-apps/keycloak.nix +++ b/nixos/modules/services/web-apps/keycloak.nix @@ -25,6 +25,7 @@ let catAttrs collect splitString + hasPrefix ; inherit (builtins) @@ -312,8 +313,9 @@ in http-relative-path = mkOption { type = str; - default = ""; + default = "/"; example = "/auth"; + apply = x: if !(hasPrefix "/") x then "/" + x else x; description = '' The path relative to / for serving resources. @@ -658,7 +660,7 @@ in '' + '' export KEYCLOAK_ADMIN=admin export KEYCLOAK_ADMIN_PASSWORD=${cfg.initialAdminPassword} - kc.sh start + kc.sh start --optimized ''; }; diff --git a/pkgs/servers/keycloak/default.nix b/pkgs/servers/keycloak/default.nix index ded809c163e5..b518f24c5340 100644 --- a/pkgs/servers/keycloak/default.nix +++ b/pkgs/servers/keycloak/default.nix @@ -13,11 +13,11 @@ stdenv.mkDerivation rec { pname = "keycloak"; - version = "18.0.0"; + version = "19.0.1"; src = fetchzip { url = "https://github.com/keycloak/keycloak/releases/download/${version}/keycloak-${version}.zip"; - sha256 = "0fxf9m50hpjplj077z2zjp0qibixz5y4lbc8159cnxbd4gzpkaaf"; + sha256 = "sha256-3hqnFH0zWvgOgpQHV4eMqTGzUWEoRwxvOcOUL2s8YQk="; }; nativeBuildInputs = [ makeWrapper jre ]; @@ -28,17 +28,14 @@ stdenv.mkDerivation rec { install -m 0600 ${confFile} conf/keycloak.conf '' + '' install_plugin() { - if [ -d "$1" ]; then - find "$1" -type f \( -iname \*.ear -o -iname \*.jar \) -exec install -m 0500 "{}" "providers/" \; - else - install -m 0500 "$1" "providers/" - fi + if [ -d "$1" ]; then + find "$1" -type f \( -iname \*.ear -o -iname \*.jar \) -exec install -m 0500 "{}" "providers/" \; + else + install -m 0500 "$1" "providers/" + fi } ${lib.concatMapStringsSep "\n" (pl: "install_plugin ${lib.escapeShellArg pl}") plugins} '' + '' - export KC_HOME_DIR=$out - export KC_CONF_DIR=$out/conf - patchShebangs bin/kc.sh bin/kc.sh build