buildRustPackage: allow patches to fix Cargo.lock

This commit is contained in:
Léo Gaspard 2018-08-13 14:44:30 +09:00
parent f8e8ecde51
commit 48e5fbe8ee
No known key found for this signature in database
GPG key ID: 8A55848B6090F9CF
2 changed files with 8 additions and 3 deletions

View file

@ -7,6 +7,8 @@ in
{ name, cargoSha256 ? "unset"
, src ? null
, srcs ? null
, cargoPatches ? []
, patches ? []
, sourceRoot ? null
, logLevel ? ""
, buildInputs ? []
@ -23,6 +25,7 @@ let
cargoDeps = if cargoVendorDir == null
then fetchcargo {
inherit name src srcs sourceRoot cargoUpdateHook;
patches = cargoPatches;
sha256 = cargoSha256;
}
else null;
@ -44,6 +47,8 @@ in stdenv.mkDerivation (args // {
buildInputs = [ cacert git rust.cargo rust.rustc ] ++ buildInputs;
patches = cargoPatches ++ patches;
configurePhase = args.configurePhase or ''
runHook preConfigure
# noop

View file

@ -1,11 +1,11 @@
{ stdenv, cacert, git, rust, cargo-vendor }:
{ name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }:
{ name ? "cargo-deps", src, srcs, patches, sourceRoot, sha256, cargoUpdateHook ? "" }:
stdenv.mkDerivation {
name = "${name}-vendor";
nativeBuildInputs = [ cacert cargo-vendor git rust.cargo ];
inherit src srcs sourceRoot;
inherit src srcs patches sourceRoot;
phases = "unpackPhase installPhase";
phases = "unpackPhase patchPhase installPhase";
installPhase = ''
if [[ ! -f Cargo.lock ]]; then