buildRustPackage: add useFetchCargoVendor flag

This commit is contained in:
TomaSajt 2024-10-21 22:21:06 +02:00
parent 1911b1e399
commit 37ce479c7b
No known key found for this signature in database
GPG Key ID: F011163C050122A1
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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; };