diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index 6ce4cadfd1cf..6e8d13415dea 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -1,6 +1,7 @@ { lib , importCargoLock , fetchCargoTarball +, fetchCargoVendor , stdenv , callPackage , cargoBuildHook @@ -36,6 +37,7 @@ , cargoDepsHook ? "" , buildType ? "release" , meta ? {} +, useFetchCargoVendor ? false , cargoLock ? null , cargoVendorDir ? null , checkType ? buildType @@ -67,6 +69,12 @@ let cargoDeps = if cargoVendorDir != null then null else if cargoLock != null then importCargoLock cargoLock + else if useFetchCargoVendor then (fetchCargoVendor { + inherit src srcs sourceRoot preUnpack unpackPhase postUnpack; + name = cargoDepsName; + patches = cargoPatches; + hash = args.cargoHash; + } // depsExtraArgs) else fetchCargoTarball ({ inherit src srcs sourceRoot preUnpack unpackPhase postUnpack cargoUpdateHook; name = cargoDepsName; diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index 81c1ac960f9a..4078041928be 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -22,7 +22,7 @@ rec { buildRustPackage = callPackage ../../../build-support/rust/build-rust-package { inherit stdenv cargoBuildHook cargoCheckHook cargoInstallHook cargoNextestHook cargoSetupHook - fetchCargoTarball importCargoLock rustc cargo cargo-auditable; + fetchCargoTarball fetchCargoVendor importCargoLock rustc cargo cargo-auditable; }; importCargoLock = buildPackages.callPackage ../../../build-support/rust/import-cargo-lock.nix { inherit cargo; };