rustPlatform.fetchCargoVendor: add allowGitDependencies

This will make it possible to use fetchCargoVendor for packages that
are in the dependency graph of nix-prefetch-git, by having them opt
out of having nix-prefetch-git involved in fetching their
dependencies.
This commit is contained in:
Alyssa Ross
2025-01-28 12:52:12 +01:00
parent 50d16c29d7
commit f07977cfd2
+12 -5
View File
@@ -35,6 +35,9 @@ in
name ? if args ? pname && args ? version then "${args.pname}-${args.version}" else "cargo-deps",
hash ? (throw "fetchCargoVendor requires a `hash` value to be set for ${name}"),
nativeBuildInputs ? [ ],
# This is mostly for breaking infinite recursion where dependencies
# of nix-prefetch-git use fetchCargoVendor.
allowGitDependencies ? true,
...
}@args:
@@ -53,11 +56,15 @@ let
{
name = "${name}-vendor-staging";
nativeBuildInputs = [
fetchCargoVendorUtil
nix-prefetch-git
cacert
] ++ nativeBuildInputs;
nativeBuildInputs =
[
fetchCargoVendorUtil
cacert
]
++ lib.optionals allowGitDependencies [
nix-prefetch-git
]
++ nativeBuildInputs;
buildPhase = ''
runHook preBuild