summary refs log tree commit diff
path: root/pkgs/build-support/rust/import-cargo-lock.nix
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-02-09 23:50:25 -0500
committerWinter <winter@winter.cafe>2023-02-26 00:46:36 -0500
commit6fcd1dcb0bdd12676fae025f5f2a5f56cf363968 (patch)
treed687e6b1fe216614cedd963926907a72e7699de5 /pkgs/build-support/rust/import-cargo-lock.nix
parent115e3413e1ffb822d490ed11fa0d36d5f01cc268 (diff)
downloadnixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar.gz
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar.bz2
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar.lz
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar.xz
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.tar.zst
nixpkgs-6fcd1dcb0bdd12676fae025f5f2a5f56cf363968.zip
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
Diffstat (limited to 'pkgs/build-support/rust/import-cargo-lock.nix')
-rw-r--r--pkgs/build-support/rust/import-cargo-lock.nix13
1 files 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 4ce552debe8..9ff9c2f6289 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
 
     ${