diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2021-02-26 10:25:13 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2021-02-26 10:25:13 +0100 |
commit | c456a2512f7a7558cbe25328a423762033822cc0 (patch) | |
tree | d64f521751037012a1c4d05fedeb485eeee39b05 /doc/languages-frameworks | |
parent | babf9d6100c3e5dcdbbbe8850de99d3fe2b3cf86 (diff) | |
parent | 6d7128414cf2763ab14f31365c21c6cec3547dac (diff) | |
download | nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar.gz nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar.bz2 nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar.lz nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar.xz nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.tar.zst nixpkgs-c456a2512f7a7558cbe25328a423762033822cc0.zip |
Merge master into staging-next
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 2290d92f7ad..94f94aaffe3 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 |