Skip to content

Commit 8f50bf2

Browse files
committed
Add ability to override lockfile from tools.nix
1 parent a40edce commit 8f50bf2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ rec {
3030
, src
3131
, cargoToml ? "Cargo.toml"
3232
, additionalCargoNixArgs ? [ ]
33+
, overrideLockFile ? null
3334
}:
3435
let
3536
crateDir = dirOf (src + "/${cargoToml}");
36-
vendor = internal.vendorSupport { inherit crateDir; };
37+
vendor = overrideLockFile (internal.vendorSupport {
38+
inherit crateDir;
39+
additionalLockFiles = if overrideLockFile == null then [ ] else [ overrideLockFile ];
40+
});
3741
in
3842
stdenv.mkDerivation {
3943
name = "${name}-crate2nix";
@@ -52,6 +56,11 @@ rec {
5256
export CARGO_HOME="$out/cargo"
5357
export HOME="$out"
5458
59+
${if overrideLockFile == null then
60+
""
61+
else
62+
"cp ${overrideLockFile} ./Cargo.lock"}
63+
5564
cp ${vendor.cargoConfig} $out/cargo/config
5665
5766
crate_hashes="$out/crate-hashes.json"

0 commit comments

Comments
 (0)