bankserver_rust/package.nix
2025-03-01 18:50:14 +01:00

42 lines
873 B
Nix

{
lib,
rustPlatform,
stdenv,
redocly,
yq-go,
targetPlatform,
rev ? "dirty",
}:
rustPlatform.buildRustPackage {
pname = "bankingserver";
version = "unstable-${rev}";
src = lib.cleanSource ./.;
nativeBuildInputs = [
redocly
yq-go
];
preBuild = ''
cargo test --features schemas --target ${stdenv.buildPlatform.rust.rustcTarget}
yq eval-all -n 'load("openapi-def.yaml") *n load("schemas/schemas.json")' > openapi-temp.yaml
redocly bundle openapi-temp.yaml -o openapi.json
'';
buildType = "debug";
useFetchCargoVendor = false;
cargoLock.lockFile = ./Cargo.lock;
cargoLock.outputHashes = {
"dbmigrator-0.4.4-alpha" = "sha256-Nwxw74IyZeZ9dODb+aneQmuQe0grO+g45B3zv1XaihE=";
};
CARGO_BUILD_TARGET = targetPlatform.config;
TARGET_CC = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
doCheck = false;
}