flake.nix: build with crane for vm
All checks were successful
Build and test / check (push) Successful in 1m30s
Build and test / build (push) Successful in 3m56s
Build and test / test (push) Successful in 2m55s
Build and test / check-license (push) Successful in 5m32s
Build and test / docs (push) Successful in 6m47s

This commit is contained in:
2025-11-26 01:10:01 +09:00
parent 412e5c1604
commit 39fa228d1c
3 changed files with 47 additions and 17 deletions

View File

@@ -5,16 +5,22 @@
, cargoLock
, src
, installShellFiles
, useCrane ? false
, craneLib ? null
}:
let
mainProgram = (lib.head cargoToml.bin).name;
buildFunction = if useCrane then craneLib.buildPackage else rustPlatform.buildRustPackage;
cargoLock' = if useCrane then cargoLock else { lockFile = cargoLock; };
pname = if useCrane then "${cargoToml.package.name}-crane" else cargoToml.package.name;
in
rustPlatform.buildRustPackage {
pname = cargoToml.package.name;
buildFunction {
pname = pname;
version = cargoToml.package.version;
inherit src;
cargoLock.lockFile = cargoLock;
cargoLock = cargoLock';
nativeBuildInputs = [ installShellFiles ];
postInstall = let