2018-02-03 17:09:00 -07:00
|
|
|
{ stdenv, cacert, git, rust, cargo-vendor }:
|
2015-05-29 11:35:31 -06:00
|
|
|
{ name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }:
|
2014-10-10 08:59:37 -06:00
|
|
|
stdenv.mkDerivation {
|
2017-08-05 08:38:48 -06:00
|
|
|
name = "${name}-vendor";
|
2018-02-03 17:09:00 -07:00
|
|
|
nativeBuildInputs = [ cacert cargo-vendor git rust.cargo ];
|
2017-08-05 08:38:48 -06:00
|
|
|
inherit src srcs sourceRoot;
|
2015-05-29 11:35:31 -06:00
|
|
|
|
|
|
|
phases = "unpackPhase installPhase";
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-08-05 08:38:48 -06:00
|
|
|
if [[ ! -f Cargo.lock ]]; then
|
|
|
|
echo
|
|
|
|
echo "ERROR: The Cargo.lock file doesn't exist"
|
|
|
|
echo
|
|
|
|
echo "Cargo.lock is needed to make sure that cargoSha256 doesn't change"
|
|
|
|
echo "when the registry is updated."
|
|
|
|
echo
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-02-25 04:05:14 -07:00
|
|
|
|
2017-08-05 08:38:48 -06:00
|
|
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
|
|
|
|
2018-02-22 21:17:03 -07:00
|
|
|
${cargoUpdateHook}
|
|
|
|
|
2017-08-05 08:38:48 -06:00
|
|
|
cargo vendor
|
2016-02-25 04:05:14 -07:00
|
|
|
|
2017-08-05 08:38:48 -06:00
|
|
|
cp -ar vendor $out
|
2015-05-29 11:35:31 -06:00
|
|
|
'';
|
2014-10-10 08:59:37 -06:00
|
|
|
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHash = sha256;
|
|
|
|
|
2016-09-17 13:50:01 -06:00
|
|
|
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
|
2014-10-10 08:59:37 -06:00
|
|
|
preferLocalBuild = true;
|
|
|
|
}
|