summary refs log tree commit diff
path: root/pkgs/build-support/rust/default.nix
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2020-03-18 20:43:07 -0400
committerJon <jonringer@users.noreply.github.com>2020-03-18 20:12:32 -0700
commit05343f6ff134c771802e554bbdacd109b7434933 (patch)
tree21c0af5e0b3ae7a06f2f034101b9cffcbbe7ae59 /pkgs/build-support/rust/default.nix
parent6865db4d3cda54c131df09c124fd49bbd2639bb7 (diff)
downloadnixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar.gz
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar.bz2
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar.lz
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar.xz
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.tar.zst
nixpkgs-05343f6ff134c771802e554bbdacd109b7434933.zip
rust: remove legacy cargo fetcher
We have now migrated every single Rust package in NixPkgs! This deletes the
legacy fetcher, which is now unused.

Resolves #79975
Diffstat (limited to 'pkgs/build-support/rust/default.nix')
-rw-r--r--pkgs/build-support/rust/default.nix23
1 files changed, 6 insertions, 17 deletions
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index f42f951680f..7cfd03a4e26 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cacert, git, rust, cargo, rustc, fetchcargo, fetchCargoTarball, buildPackages, windows }:
+{ stdenv, cacert, git, rust, cargo, rustc, fetchCargoTarball, buildPackages, windows }:
 
 { name ? "${args.pname}-${args.version}"
 , cargoSha256 ? "unset"
@@ -14,7 +14,6 @@
 , cargoUpdateHook ? ""
 , cargoDepsHook ? ""
 , cargoBuildFlags ? []
-, legacyCargoFetcher ? false
 , buildType ? "release"
 , meta ? {}
 , target ? null
@@ -26,21 +25,17 @@ assert buildType == "release" || buildType == "debug";
 
 let
 
-  cargoFetcher = if legacyCargoFetcher
-                 then fetchcargo
-                 else fetchCargoTarball;
-
   cargoDeps = if cargoVendorDir == null
-    then cargoFetcher {
+    then fetchCargoTarball {
         inherit name src srcs sourceRoot unpackPhase cargoUpdateHook;
         patches = cargoPatches;
         sha256 = cargoSha256;
       }
     else null;
 
-  # If we're using the modern fetcher that always preserves the original Cargo.lock
-  # and have vendored deps, check them against the src attr for consistency.
-  validateCargoDeps = cargoSha256 != "unset" && !legacyCargoFetcher;
+  # If we have a cargoSha256 fixed-output derivation, validate it at build time
+  # against the src fixed-output derivation to check consistency.
+  validateCargoDeps = cargoSha256 != "unset";
 
   # Some cargo builds include build hooks that modify their own vendor
   # dependencies. This copies the vendor directory into the build tree and makes
@@ -50,8 +45,6 @@ let
     then (''
       unpackFile "$cargoDeps"
       cargoDepsCopy=$(stripHash $cargoDeps)
-    '' + stdenv.lib.optionalString legacyCargoFetcher ''
-      chmod -R +w "$cargoDepsCopy"
     '')
     else ''
       cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
@@ -65,13 +58,9 @@ let
   cxxForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
   releaseDir = "target/${rustTarget}/${buildType}";
 
-  # Fetcher implementation choice should not be part of the hash in final
-  # derivation; only the cargoSha256 input matters.
-  filteredArgs = builtins.removeAttrs args [ "legacyCargoFetcher" ];
-
 in
 
-stdenv.mkDerivation (filteredArgs // {
+stdenv.mkDerivation (args // {
   inherit cargoDeps;
 
   patchRegistryDeps = ./patch-registry-deps;