From 6fcd1dcb0bdd12676fae025f5f2a5f56cf363968 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 9 Feb 2023 23:50:25 -0500 Subject: [PATCH] rustPlatform.importCargoLock: passthru lockFile This is to make it possible to implement support for updating `Cargo.lock`s in nix-update by exposing the path to the `Cargo.lock` file --- pkgs/build-support/rust/import-cargo-lock.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 ${