diff options
author | Graham Christensen <graham@grahamc.com> | 2021-02-23 10:02:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 10:02:45 -0500 |
commit | 3ef281c3a2f950331f4154436ff511daf70fb724 (patch) | |
tree | 31aa7fd0b6b570bb28b8d07b2ef4e2cdf0fe8381 /doc/languages-frameworks | |
parent | 5eafa2966dbf9202811b79523301afb32fcb87a1 (diff) | |
parent | d92396039df6cf4c609cf1be47d0802496560e17 (diff) | |
download | nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar.gz nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar.bz2 nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar.lz nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar.xz nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.tar.zst nixpkgs-3ef281c3a2f950331f4154436ff511daf70fb724.zip |
Merge pull request #113176 from danieldk/cargoDepsName
buildRustPackage: add cargoDepsName attribute
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r-- | doc/languages-frameworks/rust.section.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 8f6db28ab4d..18d3cd9c926 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -80,6 +80,33 @@ The fetcher will verify that the `Cargo.lock` file is in sync with the `src` attribute, and fail the build if not. It will also will compress the vendor directory into a tar.gz archive. +The tarball with vendored dependencies contains a directory with the +package's `name`, which is normally composed of `pname` and +`version`. This means that the vendored dependencies hash +(`cargoSha256`/`cargoHash`) is dependent on the package name and +version. The `cargoDepsName` attribute can be used to use another name +for the directory of vendored dependencies. For example, the hash can +be made invariant to the version by setting `cargoDepsName` to +`pname`: + +```nix +rustPlatform.buildRustPackage rec { + pname = "broot"; + version = "1.2.0"; + + src = fetchCrate { + inherit pname version; + sha256 = "1mqaynrqaas82f5957lx31x80v74zwmwmjxxlbywajb61vh00d38"; + }; + + cargoHash = "sha256-JmBZcDVYJaK1cK05cxx5BrnGWp4t8ca6FLUbvIot67s="; + cargoDepsName = pname; + + # ... +} +``` + + ### Cross compilation By default, Rust packages are compiled for the host platform, just like any |