From 97958e72e8a9223c539397d90ef7552d80512d60 Mon Sep 17 00:00:00 2001 From: "Adam C. Stephens" Date: Mon, 9 Dec 2024 17:43:11 +0000 Subject: [PATCH] kanidm: add back 1.3 compatibility --- pkgs/by-name/ka/kanidm/generic.nix | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/ka/kanidm/generic.nix b/pkgs/by-name/ka/kanidm/generic.nix index 5bbf2a135eab..607062bafdda 100644 --- a/pkgs/by-name/ka/kanidm/generic.nix +++ b/pkgs/by-name/ka/kanidm/generic.nix @@ -55,18 +55,24 @@ rustPlatform.buildRustPackage rec { postPatch = let format = (formats.toml { }).generate "${KANIDM_BUILD_PROFILE}.toml"; - profile = { - admin_bind_path = "/run/kanidmd/sock"; - cpu_flags = if stdenv.hostPlatform.isx86_64 then "x86_64_legacy" else "none"; - default_config_path = "/etc/kanidm/server.toml"; - default_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash"; - htmx_ui_pkg_path = "@htmx_ui_pkg_path@"; - }; + profile = + { + admin_bind_path = "/run/kanidmd/sock"; + cpu_flags = if stdenv.hostPlatform.isx86_64 then "x86_64_legacy" else "none"; + default_config_path = "/etc/kanidm/server.toml"; + default_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash"; + htmx_ui_pkg_path = "@htmx_ui_pkg_path@"; + } + // lib.optionalAttrs (lib.versions.majorMinor version == "1.3") { + web_ui_pkg_path = "@web_ui_pkg_path@"; + }; in '' cp ${format profile} libs/profiles/${KANIDM_BUILD_PROFILE}.toml - substituteInPlace libs/profiles/${KANIDM_BUILD_PROFILE}.toml \ - --replace-fail '@htmx_ui_pkg_path@' "$out/ui/hpkg" + substituteInPlace libs/profiles/${KANIDM_BUILD_PROFILE}.toml --replace-fail '@htmx_ui_pkg_path@' "$out/ui/hpkg" + '' + + lib.optionalString (lib.versions.majorMinor version == "1.3") '' + substituteInPlace libs/profiles/${KANIDM_BUILD_PROFILE}.toml --replace-fail '@web_ui_pkg_path@' "$out/ui/pkg" ''; nativeBuildInputs = [ @@ -83,10 +89,14 @@ rustPlatform.buildRustPackage rec { ]; # The UI needs to be in place before the tests are run. - postBuild = '' - mkdir -p $out/ui - cp -r server/core/static $out/ui/hpkg - ''; + postBuild = + '' + mkdir -p $out/ui + cp -r server/core/static $out/ui/hpkg + '' + + lib.optionalString (lib.versions.majorMinor version == "1.3") '' + cp -r server/web_ui/pkg $out/ui/pkg + ''; # Upstream runs with the Rust equivalent of -Werror, # which breaks when we upgrade to new Rust before them.