feat(rust): update crane builder, make sure vendor dir reference removal works

This commit is contained in:
Yusuf Bera Ertan 2022-12-14 18:14:49 +03:00
parent 091440502b
commit 1576b6321b
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
2 changed files with 8 additions and 6 deletions

View File

@ -42,11 +42,11 @@
"crane": {
"flake": false,
"locked": {
"lastModified": 1670284777,
"narHash": "sha256-JF0pc0s4z/X+Iy+lNHOwUQ8I5bz+q7uX4HrKTNIEj24=",
"lastModified": 1670900067,
"narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2243fb9c872de25cb564a02d324ea6a5b9853052",
"rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b",
"type": "github"
},
"original": {

View File

@ -55,10 +55,12 @@
inherit pname version;
src = utils.getRootSource pname version;
cargoVendorDir = "./nix-vendor";
cargoVendorDir = "$TMPDIR/nix-vendor";
installCargoArtifactsMode = "use-zstd";
postUnpack = ''
export CARGO_HOME=$(pwd)/.cargo_home
export cargoVendorDir="$TMPDIR/nix-vendor"
'';
preConfigure = ''
${writeGitVendorEntries}
@ -86,7 +88,7 @@
cargoCheckCommand = "cargo check --release --package ${pname}";
dream2nixVendorDir = vendoring.vendoredDependencies;
preUnpack = ''
${vendoring.copyVendorDir "$dream2nixVendorDir" "$cargoVendorDir"}
${vendoring.copyVendorDir "$dream2nixVendorDir" common.cargoVendorDir}
'';
# move the vendored dependencies folder to $out for main derivation to use
postInstall = ''
@ -105,7 +107,7 @@
cargoArtifacts = deps;
# link the vendor dir we used earlier to the correct place
preUnpack = ''
${vendoring.copyVendorDir "$cargoArtifacts/nix-vendor" "$cargoVendorDir"}
${vendoring.copyVendorDir "$cargoArtifacts/nix-vendor" common.cargoVendorDir}
'';
# write our cargo lock
# note: we don't do this in buildDepsOnly since