Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: update docs on legacyCargoFetcher; remove unnecessary defaults #80164

Merged
merged 1 commit into from
Feb 16, 2020
Merged
Show file tree
Hide file tree
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
17 changes: 3 additions & 14 deletions doc/languages-frameworks/rust.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ rustPlatform.buildRustPackage rec {
};

cargoSha256 = "17ldqr3asrdcsh4l29m3b5r37r5d0b3npq1lrgjmxb6vlx6a36qh";
legacyCargoFetcher = false;

meta = with stdenv.lib; {
description = "A fast line-oriented regex search tool, similar to ag and ack";
Expand All @@ -59,19 +58,9 @@ When the `Cargo.lock`, provided by upstream, is not in sync with the
added in `cargoPatches` will also be prepended to the patches in `patches` at
build-time.

Setting `legacyCargoFetcher` to `false` enables the following behavior:

1. The `Cargo.lock` file is copied into the cargo vendor directory.
2. At buildtime, `buildRustPackage` will ensure that the `src` and `cargoSha256`
are consistent. This avoids errors where one but not the other is updated.
3. The builder will compress the vendored cargo src directory into a tar.gz file
for storage after vendoring, and decompress it before the build. This saves
disk space and enables hashed mirrors for Rust dependencies.

Note that this option changes the value of `cargoSha256`, so it is currently
defaulted to `false`. When updating a Rust package, please set it to `true`;
eventually we will default this to true and update the remaining Rust packages,
then delete the option from all individual Rust package expressions.
Unless `legacyCargoFetcher` is set to `true`, the fetcher will also verify that
the `Cargo.lock` file is in sync with the `src` attribute, and will compress the
vendor directory into a tar.gz archive.

### Building a crate for a different target

Expand Down
4 changes: 1 addition & 3 deletions pkgs/applications/audio/spotify-tui/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ rustPlatform.buildRustPackage rec {
sha256 = "06xqj83m4hz00p8796m0df7lv9875p8zc1v6l9yqbiak1h95lq7h";
};

legacyCargoFetcher = false;

cargoSha256 = "1pc4n6lm1w0660ivm0kxzicpckvb351y62dpv0cxa7ckd3raa5pr";

nativeBuildInputs = [ pkgconfig ] ++ stdenv.lib.optionals stdenv.isLinux [ python3 ];
buildInputs = [ openssl ]
++ stdenv.lib.optional stdenv.isLinux libxcb
++ stdenv.lib.optional stdenv.isLinux libxcb
++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Security ];

meta = with stdenv.lib; {
Expand Down
2 changes: 0 additions & 2 deletions pkgs/applications/audio/spotifyd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ rustPlatform.buildRustPackage rec {
sha256 = "08i0zm7kgprixqjpgaxk7xid1njgj6lmi896jf9fsjqzdzlblqk8";
};

legacyCargoFetcher = false;

cargoSha256 = "0200apqbx769ggjnjr0m72g61ikhml2xak5n1il2pvfx1yf5nw0n";

cargoBuildFlags = [
Expand Down
1 change: 0 additions & 1 deletion pkgs/applications/editors/hexdino/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rustPlatform.buildRustPackage {
};

cargoSha256 = "06ghcd4j751mdkzwb88nqwk8la4zdb137y0iqrkpykkfx0as43x3";
legacyCargoFetcher = false;

buildInputs = [ ncurses ];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ rustPlatform.buildRustPackage rec {

cargoSha256 = "1z4cb7rcb7ldj16xxynrjh4hg872rj39rbbp0vy15kdp3ifyi466";

legacyCargoFetcher = false;

buildInputs = with stdenv; lib.optional isDarwin Security;

meta = with stdenv.lib; {
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/tools/documentation/mdsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rustPlatform.buildRustPackage rec {
};

cargoSha256 = "1fxajh1n0qvcdas6w7dy3g92wilhfldy90pyk3779mrnh57fa6n5";
legacyCargoFetcher = false;

meta = with stdenv.lib; {
description = "Markdown shell pre-processor";
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/misc/broot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rustPlatform.buildRustPackage rec {
};

cargoSha256 = "0zrwpmsrzwnjml0964zky8w222zmlargha3z0n6hf8cfshx23s4k";
legacyCargoFetcher = false;

nativeBuildInputs = [ installShellFiles ];

Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/misc/wagyu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rustPlatform.buildRustPackage rec {
};

cargoSha256 = "16d1b3pamkg29nq80n6cbzc4zl9z3cgfvdxjkr2z4xrnzmkn1ysi";
legacyCargoFetcher = false;

meta = with lib; {
description = "Rust library for generating cryptocurrency wallets";
Expand Down
3 changes: 1 addition & 2 deletions pkgs/tools/package-management/cargo-tree/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ stdenv, lib, rustPlatform, fetchFromGitHub, pkgconfig, cmake, curl, libiconv, darwin }:

rustPlatform.buildRustPackage rec {
pname = "cargo-tree";
version = "0.29.0";
Expand All @@ -10,8 +11,6 @@ rustPlatform.buildRustPackage rec {
sha256 = "16k41pj66m2221n1v2szir7x7qwx4i0g3svck2c8cj76h0bqyy15";
};

legacyCargoFetcher = false;

cargoSha256 = "0762gdj4n5mlflhzynnny1h8z792zyxmb4kcn54jj7qzdask4qdy";

nativeBuildInputs = [ pkgconfig cmake ];
Expand Down
3 changes: 2 additions & 1 deletion pkgs/tools/package-management/nix-du/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ stdenv, fetchFromGitHub, rustPlatform, nix, boost, graphviz, darwin }:

rustPlatform.buildRustPackage rec {
pname = "nix-du";
version = "0.3.1";
Expand All @@ -9,8 +10,8 @@ rustPlatform.buildRustPackage rec {
rev = "v${version}";
sha256 = "149d60mid29s5alv5m3d7jrhyzc6cj7b6hpiq399gsdwzgxr00wq";
};

cargoSha256 = "1a6svl89dcdb5fpvs2i32i6agyhl0sx7kkkw70rqr17fyzl5psai";
legacyCargoFetcher = false;

doCheck = true;
checkInputs = [ graphviz ];
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/security/fido2luks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ pkg-config ];

cargoSha256 = "0rp4f6xnwmvf3pv6h0qwsg01jrndf77yn67675ac39kxzmrzfy2f";
legacyCargoFetcher = false;

meta = with stdenv.lib; {
description = "Decrypt your LUKS partition using a FIDO2 compatible authenticator";
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/system/tre-command/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rustPlatform.buildRustPackage rec {
};

cargoSha256 = "1m3ccp5ncafkifg8sxyxczsg3ja1gvq8wmgni68bgzm2lwxh2qgw";
legacyCargoFetcher = false;

meta = with stdenv.lib; {
description = "Tree command, improved";
Expand Down