diff --git a/pkgs/build-support/rust/import-cargo-lock.nix b/pkgs/build-support/rust/import-cargo-lock.nix index 4ce552debe82..9ff9c2f6289c 100644 --- a/pkgs/build-support/rust/import-cargo-lock.nix +++ b/pkgs/build-support/rust/import-cargo-lock.nix @@ -184,10 +184,15 @@ let '' else throw "Cannot handle crate source: ${pkg.source}"; - vendorDir = runCommand "cargo-vendor-dir" (lib.optionalAttrs (lockFile == null) { - inherit lockFileContents; - passAsFile = [ "lockFileContents" ]; - }) '' + vendorDir = runCommand "cargo-vendor-dir" + (if lockFile == null then { + inherit lockFileContents; + passAsFile = [ "lockFileContents" ]; + } else { + passthru = { + inherit lockFile; + }; + }) '' mkdir -p $out/.cargo ${