Skip to content

Commit

Permalink
Merge pull request #105305 from lopsided98/build-rust-crate-platform-…
Browse files Browse the repository at this point in the history
…hash

buildRustCrate: add host platform to rlib hash suffix
  • Loading branch information
Ericson2314 authored Nov 29, 2020
2 parents a86b1f4 + 8c47905 commit 7781642
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkgs/build-support/rust/build-rust-crate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ let
};

installCrate = import ./install-crate.nix { inherit stdenv; };

# Allow access to the rust attribute set from inside buildRustCrate, which
# has a parameter that shadows the name.
rustAttrs = rust;
in

/* The overridable pkgs.buildRustCrate function.
Expand Down Expand Up @@ -250,7 +254,7 @@ stdenv.mkDerivation (rec {
depsMetadata = lib.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies);
hashedMetadata = builtins.hashString "sha256"
(crateName + "-" + crateVersion + "___" + toString (mkRustcFeatureArgs crateFeatures) +
"___" + depsMetadata);
"___" + depsMetadata + "___" + rustAttrs.toRustTarget stdenv.hostPlatform);
in lib.substring 0 10 hashedMetadata;

build = crate.build or "";
Expand Down

0 comments on commit 7781642

Please sign in to comment.