Adam Stephens 2024-08-09 01:12:30 +00:00
parent 2cd969c108
commit f03bf83b1e
No known key found for this signature in database

View File

@ -20,16 +20,16 @@ let
in in
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "kanidm"; pname = "kanidm";
version = "1.2.3"; version = "1.3.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = pname; owner = pname;
repo = pname; repo = pname;
rev = "refs/tags/v${version}"; rev = "refs/tags/v${version}";
hash = "sha256-J02IbAY5lyoMaq6wJiHizqeFBd5hB6id2YMPxlPsASM="; hash = "sha256-vjYbj8wIrnVCrokmXv6h4V/n02nKtUQ/mh1xosXj4IE=";
}; };
cargoHash = "sha256-JuTKHXpEhWga2vAZhCpyPFy4w6+9UaasD70oBcrr0Rw="; cargoHash = "sha256-ASDfIpwvgYR3vukhtpXJWles5ErytUpW2VjYIpidyWk=";
KANIDM_BUILD_PROFILE = "release_nixos_${arch}"; KANIDM_BUILD_PROFILE = "release_nixos_${arch}";
@ -41,13 +41,15 @@ rustPlatform.buildRustPackage rec {
cpu_flags = if stdenv.isx86_64 then "x86_64_legacy" else "none"; cpu_flags = if stdenv.isx86_64 then "x86_64_legacy" else "none";
default_config_path = "/etc/kanidm/server.toml"; default_config_path = "/etc/kanidm/server.toml";
default_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash"; default_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash";
htmx_ui_pkg_path = "@htmx_ui_pkg_path@";
web_ui_pkg_path = "@web_ui_pkg_path@"; web_ui_pkg_path = "@web_ui_pkg_path@";
}; };
in in
'' ''
cp ${format profile} libs/profiles/${KANIDM_BUILD_PROFILE}.toml cp ${format profile} libs/profiles/${KANIDM_BUILD_PROFILE}.toml
substituteInPlace libs/profiles/${KANIDM_BUILD_PROFILE}.toml \ substituteInPlace libs/profiles/${KANIDM_BUILD_PROFILE}.toml \
--replace '@web_ui_pkg_path@' "${placeholder "out"}/ui" --replace '@htmx_ui_pkg_path@' "${placeholder "out"}/ui/hpkg" \
--replace '@web_ui_pkg_path@' "${placeholder "out"}/ui/pkg"
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
@ -67,8 +69,9 @@ rustPlatform.buildRustPackage rec {
postBuild = '' postBuild = ''
# We don't compile the wasm-part form source, as there isn't a rustc for # We don't compile the wasm-part form source, as there isn't a rustc for
# wasm32-unknown-unknown in nixpkgs yet. # wasm32-unknown-unknown in nixpkgs yet.
mkdir $out mkdir -p $out/ui
cp -r server/web_ui/pkg $out/ui cp -r server/web_ui/pkg $out/ui/pkg
cp -r server/core/static $out/ui/hpkg
''; '';
# Otherwise build breaks on some unused code # Otherwise build breaks on some unused code