Skip to content

Commit

Permalink
Add ability to override lockfile from tools.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Feb 22, 2023
1 parent a40edce commit 8f50bf2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ rec {
, src
, cargoToml ? "Cargo.toml"
, additionalCargoNixArgs ? [ ]
, overrideLockFile ? null
}:
let
crateDir = dirOf (src + "/${cargoToml}");
vendor = internal.vendorSupport { inherit crateDir; };
vendor = overrideLockFile (internal.vendorSupport {
inherit crateDir;
additionalLockFiles = if overrideLockFile == null then [ ] else [ overrideLockFile ];
});
in
stdenv.mkDerivation {
name = "${name}-crate2nix";
Expand All @@ -52,6 +56,11 @@ rec {
export CARGO_HOME="$out/cargo"
export HOME="$out"
${if overrideLockFile == null then
""
else
"cp ${overrideLockFile} ./Cargo.lock"}
cp ${vendor.cargoConfig} $out/cargo/config
crate_hashes="$out/crate-hashes.json"
Expand Down

0 comments on commit 8f50bf2

Please sign in to comment.