9765ee6bbf
Release notes available at https://www.keycloak.org/docs/latest/release_notes/index.html#keycloak-18-0-0. The way the database port is configured changed in Keycloak 18 and the old way of including it in the `db-url-host` setting no longer works. Use the new `db-url-port` setting instead. Signed-off-by: Felix Singer <felixsinger@posteo.net> Signed-off-by: Kim Lindberger <kim.lindberger@gmail.com>
82 lines
2 KiB
Nix
82 lines
2 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchzip
|
|
, makeWrapper
|
|
, jre
|
|
, writeText
|
|
, nixosTests
|
|
, callPackage
|
|
|
|
, confFile ? null
|
|
, plugins ? [ ]
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "keycloak";
|
|
version = "18.0.0";
|
|
|
|
src = fetchzip {
|
|
url = "https://github.com/keycloak/keycloak/releases/download/${version}/keycloak-${version}.zip";
|
|
sha256 = "0fxf9m50hpjplj077z2zjp0qibixz5y4lbc8159cnxbd4gzpkaaf";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper jre ];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
'' + lib.optionalString (confFile != null) ''
|
|
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
|
|
}
|
|
${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
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir $out
|
|
cp -r * $out
|
|
|
|
rm $out/bin/*.{ps1,bat}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postFixup = ''
|
|
substituteInPlace $out/bin/kc.sh --replace ${lib.escapeShellArg "-Dkc.home.dir='$DIRNAME'/../"} '-Dkc.home.dir=$KC_HOME_DIR'
|
|
substituteInPlace $out/bin/kc.sh --replace ${lib.escapeShellArg "-Djboss.server.config.dir='$DIRNAME'/../conf"} '-Djboss.server.config.dir=$KC_CONF_DIR'
|
|
|
|
for script in $(find $out/bin -type f -executable); do
|
|
wrapProgram "$script" --set JAVA_HOME ${jre} --prefix PATH : ${jre}/bin
|
|
done
|
|
'';
|
|
|
|
passthru = {
|
|
tests = nixosTests.keycloak;
|
|
plugins = callPackage ./all-plugins.nix { };
|
|
enabledPlugins = plugins;
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://www.keycloak.org/";
|
|
description = "Identity and access management for modern applications and services";
|
|
license = licenses.asl20;
|
|
platforms = jre.meta.platforms;
|
|
maintainers = with maintainers; [ ngerstle talyz ];
|
|
};
|
|
|
|
}
|