Skip to content

Commit a570a6f

Browse files
authored
fix(nix): vendor Cargo deps without import-from-derivation (ccusage#1918)
* fix(nix): vendor Cargo deps without import-from-derivation buildDepsOnly receives an explicit dummySrc, so Crane vendors the Cargo dependencies from that mkDummySrc derivation. Reading its Cargo.lock during evaluation is import-from-derivation: every evaluation of the package, the dev shell, or the checks had to build that derivation first, and it fails outright with allow-import-from-derivation = false or with evaluators that never build during evaluation, such as iets. Vendor once from the filtered source in commonArgs instead. The vendor directory only depends on Cargo.lock, so the ccusage drvPath is unchanged and nothing rebuilds. * chore(nix): shorten the Cargo vendoring comment
1 parent 58ec8f1 commit a570a6f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎package.nix‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ let
4040
commonArgs = {
4141
pname = cliPackageJson.name;
4242
inherit version src;
43+
# Vendoring from mkDummySrc would be import-from-derivation.
44+
cargoVendorDir = craneLib.vendorCargoDeps { inherit src; };
4345
strictDeps = true;
4446
doCheck = false;
4547
cargoExtraArgs = "-p ccusage --bin ccusage";

0 commit comments

Comments
 (0)