From 359b09c9c15226035d37a3a93fe0074188bb3aad Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 3 Nov 2023 16:29:31 +0100 Subject: [PATCH] keycloak: Add organizations plugin --- modules/keycloak/default.nix | 13 ++++++++++++- modules/keycloak/keycloak-admin-ui.nix | 26 ++++++++++++++++++++++++++ modules/keycloak/keycloak-orgs.nix | 26 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 modules/keycloak/keycloak-admin-ui.nix create mode 100644 modules/keycloak/keycloak-orgs.nix diff --git a/modules/keycloak/default.nix b/modules/keycloak/default.nix index 2c74fed..d38520c 100644 --- a/modules/keycloak/default.nix +++ b/modules/keycloak/default.nix @@ -45,9 +45,20 @@ in keywind = keywindTheme; }; + plugins = [ + (pkgs.callPackage ./keycloak-orgs.nix { + inherit (pkgs) fetchFromGitHub; + inherit (pkgs.maven) buildMavenPackage; + }) + (pkgs.callPackage ./keycloak-admin-ui.nix { + inherit (pkgs) fetchFromGitHub; + inherit (pkgs.maven) buildMavenPackage; + keycloak = config.services.keycloak.package; + }) + ]; }; - services.caddy = { + services. caddy = { enable = true; email = "erwin@datarift.nl"; diff --git a/modules/keycloak/keycloak-admin-ui.nix b/modules/keycloak/keycloak-admin-ui.nix new file mode 100644 index 0000000..661879f --- /dev/null +++ b/modules/keycloak/keycloak-admin-ui.nix @@ -0,0 +1,26 @@ +{ buildMavenPackage +, fetchFromGitHub +, keycloak +}: +let + inherit (keycloak) version; +in +buildMavenPackage { + inherit version; + pname = "keycloak-admin-ui"; + + src = fetchFromGitHub { + owner = "keycloak"; + repo = "keycloak"; + rev = version; + hash = "sha256-Lk2CWzIV7UcDHy3hth9ccw3OUAsphM3llahHtehAcV0="; + }; + + sourceRoot = "source/integration/admin-client"; + + mvnHash = "sha256-HkVib0WCbl+/EuwUf8JiYKewIz1AntTvGySInsOkODE="; + + installPhase = '' + install -D target/keycloak-admin-client-${version}.jar $out/keycloak-admin-client-${version}.jar + ''; +} diff --git a/modules/keycloak/keycloak-orgs.nix b/modules/keycloak/keycloak-orgs.nix new file mode 100644 index 0000000..3de1668 --- /dev/null +++ b/modules/keycloak/keycloak-orgs.nix @@ -0,0 +1,26 @@ +{ buildMavenPackage +, fetchFromGitHub +}: +let + version = "0.43"; +in +buildMavenPackage { + inherit version; + pname = "keycloak-orgs"; + + src = fetchFromGitHub { + owner = "p2-inc"; + repo = "keycloak-orgs"; + rev = "v${version}"; + hash = "sha256-aOnhUdDc9GNkBJx+bG393VDgFvB+ZKVzGBP8MBbqOhU="; + }; + + mvnHash = "sha256-gOqXkyumC4/5S+Sb7/Ed7b93sR3kq660I0x4MFxFwro="; + + mvnParameters = "-Dmaven.buildNumber.skip=true"; + + installPhase = '' + install -D target/keycloak-orgs-${version}.jar $out/keycloak-orgs-${version}.jar + ''; + +}