[HACK] Minimize input closure for builds

This commit is contained in:
Zhaofeng Li 2023-06-27 13:24:53 -06:00
parent 511787c870
commit 85eeaf7343
3 changed files with 25 additions and 14 deletions

View file

@ -91,17 +91,27 @@ let
cargoExtraArgs = "--target ${crossPlatform.rustTargetSpec}"; cargoExtraArgs = "--target ${crossPlatform.rustTargetSpec}";
cargoVendorDir = craneLib.vendorMultipleCargoDeps { cargoVendorDir = let
orig = craneLib.vendorMultipleCargoDeps {
inherit (craneLib.findCargoFiles src) cargoConfigs; inherit (craneLib.findCargoFiles src) cargoConfigs;
cargoLockList = [ cargoLockList = [
./Cargo.lock ./Cargo.lock
"${rustNightly.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/Cargo.lock" "${rustNightly.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/Cargo.lock"
]; ];
}; };
in pkgs.runCommandLocal "${orig.name}-deref" {} ''
cp -rL ${orig} $out
chmod u+w $out
sed -i "s|${orig.outPath}|$out|g" "$out/config.toml"
'';
} // crossPlatform.env; } // crossPlatform.env;
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
installCargoArtifactsMode = "use-zstd";
});
crate = craneLib.buildPackage (commonArgs // { crate = craneLib.buildPackage (commonArgs // {
cargoArtifacts = craneLib.buildDepsOnly commonArgs; inherit cargoArtifacts;
# The resulting executable must be standalone # The resulting executable must be standalone
allowedRequisites = [ ]; allowedRequisites = [ ];

View file

@ -12,15 +12,16 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1687310026, "lastModified": 1687893602,
"narHash": "sha256-20RHFbrnC+hsG4Hyeg/58LvQAK7JWfFItTPFAFamu8E=", "narHash": "sha256-+Pi3GJ2ZwCHJ6z1HAKzZ3T4jbn8wdpj8sx/MZK6CmVI=",
"owner": "ipetkov", "owner": "zhaofengli",
"repo": "crane", "repo": "crane",
"rev": "116b32c30b5ff28e49f4fcbeeb1bbe3544593204", "rev": "54046f5897cef86d9e8f0e536a4b94177eecb495",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "ipetkov", "owner": "zhaofengli",
"ref": "mangled-artifacts",
"repo": "crane", "repo": "crane",
"type": "github" "type": "github"
} }

View file

@ -10,7 +10,7 @@
}; };
crane = { crane = {
url = "github:ipetkov/crane"; url = "github:zhaofengli/crane/mangled-artifacts";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-compat.follows = "flake-compat"; inputs.flake-compat.follows = "flake-compat";
}; };