diff --git a/tools.nix b/tools.nix index 5fc8d0d6..7cb93c0a 100644 --- a/tools.nix +++ b/tools.nix @@ -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"; @@ -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"