diff --git a/pkgs/build-support/rust/fetch-cargo-vendor.nix b/pkgs/build-support/rust/fetch-cargo-vendor.nix index 899c799c5fcc..e346ab659af6 100644 --- a/pkgs/build-support/rust/fetch-cargo-vendor.nix +++ b/pkgs/build-support/rust/fetch-cargo-vendor.nix @@ -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