Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkgs/build-support/rust/build-rust-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ lib.extendMkDerivation {
meta ? { },
useFetchCargoVendor ? true,
cargoDeps ? null,
cargoHash ? null,
cargoLock ? null,
cargoVendorDir ? null,
checkType ? buildType,
Expand Down Expand Up @@ -108,7 +109,7 @@ lib.extendMkDerivation {
cargoDeps
else if cargoLock != null then
importCargoLock cargoLock
else if args.cargoHash or null == null then
else if finalAttrs.cargoHash == null then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closest solution to override cargoHash at the main package and override the rest of cargoDeps attributes at cargoDeps is to

  • Select the candidate using the initial attribute
  • Define the cargo vendor candidate with finalAttrs.cargoHash.
Suggested change
else if finalAttrs.cargoHash == null then
else if cargoHash == null then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prince213 What do you think? Some people seems to be asking for this feature on Discord again.

https://discourse.nixos.org/t/overriding-version-cant-find-new-cargohash/31502/10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this later in the day.

throw "cargoHash, cargoVendorDir, cargoDeps, or cargoLock must be set"
else
fetchCargoVendor (
Expand All @@ -124,11 +125,14 @@ lib.extendMkDerivation {
;
name = cargoDepsName;
patches = cargoPatches;
hash = args.cargoHash;
hash = finalAttrs.cargoHash;
}
// depsExtraArgs
);
inherit buildAndTestSubdir;
inherit
buildAndTestSubdir
cargoHash
;

cargoBuildType = buildType;

Expand Down
Loading