kanidm: add back 1.3 compatibility

This commit is contained in:
Adam C. Stephens 2024-12-09 17:43:11 +00:00
parent 33fe023937
commit 97958e72e8
No known key found for this signature in database

View File

@ -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.