Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/pkgs/build-support/rust/cargo-vendor/default.nix b/pkgs/build-support/rust/cargo-vendor/default.nix
- index faeb6e03743..5d5e2b1d88b 100644
- --- a/pkgs/build-support/rust/cargo-vendor/default.nix
- +++ b/pkgs/build-support/rust/cargo-vendor/default.nix
- @@ -1,10 +1,32 @@
- -{ callPackage, fetchFromGitHub }:
- +{ stdenv, callPackage, fetchFromGitHub, pkgconfig, openssl, curl, libssh2, cmake }:
- +
- +let
- + cargo-vendor-bootstrap = (callPackage ./cargo-vendor-bootstrap.nix {}).cargo_vendor_0_1_13.overrideAttrs (attrs: {
- + src = fetchFromGitHub {
- + owner = "alexcrichton";
- + repo = "cargo-vendor";
- + rev = "0.1.13";
- + sha256 = "0ljh2d65zpxp26a95b3czy5ai2z2dm87x7ndfdc1s0v1fsy69kn4";
- + };
- + });
- + buildRustPackage = callPackage ../. { cargo-vendor = cargo-vendor-bootstrap; };
- +in
- +buildRustPackage rec {
- + name = "cargo-vendor-${version}";
- + version = "0.1.16";
- -(callPackage ./cargo-vendor.nix {}).cargo_vendor_0_1_13.overrideAttrs (attrs: {
- src = fetchFromGitHub {
- owner = "alexcrichton";
- repo = "cargo-vendor";
- - rev = "0.1.13";
- - sha256 = "0ljh2d65zpxp26a95b3czy5ai2z2dm87x7ndfdc1s0v1fsy69kn4";
- + rev = "${version}";
- + sha256 = "03pllm7y9k1sk8ch5rz6wlmj19k5niv32rn89fwsw0mfv0hcfs35";
- };
- -})
- +
- + cargoSha256 = "0g4p12hikmw4whdqkjamj5kbbwih0l3i67h728hjdb4q8phn6vvg";
- +
- + buildInputs = [ openssl curl libssh2 ];
- +
- + nativeBuildInputs = [ pkgconfig cmake ];
- +
- + doCheck = false;
- +}
- diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
- index 820989a7620..68654538d75 100644
- --- a/pkgs/build-support/rust/default.nix
- +++ b/pkgs/build-support/rust/default.nix
- @@ -30,14 +30,19 @@ let
- }
- else null;
- - setupVendorDir = if cargoVendorDir == null
- + setupCargoConfig = if cargoVendorDir == null
- then ''
- - unpackFile "$cargoDeps"
- - cargoDepsCopy=$(stripHash $(basename $cargoDeps))
- - chmod -R +w "$cargoDepsCopy"
- + cp ${cargoDeps}/config .cargo/config
- ''
- else ''
- - cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
- + cat >.cargo/config <<-EOF
- + [source.crates-io]
- + registry = 'https://github.com/rust-lang/crates.io-index'
- + replace-with = 'vendored-sources'
- +
- + [source.vendored-sources]
- + directory = '$(pwd)/$sourceRoot/${cargoVendorDir}'
- + EOF
- '';
- in stdenv.mkDerivation (args // {
- @@ -58,19 +63,8 @@ in stdenv.mkDerivation (args // {
- postUnpack = ''
- eval "$cargoDepsHook"
- - ${setupVendorDir}
- -
- mkdir .cargo
- - cat >.cargo/config <<-EOF
- - [source.crates-io]
- - registry = 'https://github.com/rust-lang/crates.io-index'
- - replace-with = 'vendored-sources'
- -
- - [source.vendored-sources]
- - directory = '$(pwd)/$cargoDepsCopy'
- - EOF
- -
- - unset cargoDepsCopy
- + ${setupCargoConfig}
- export RUST_LOG=${logLevel}
- '' + (args.postUnpack or "");
- diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix
- index 2670ed52864..91520009740 100644
- --- a/pkgs/build-support/rust/fetchcargo.nix
- +++ b/pkgs/build-support/rust/fetchcargo.nix
- @@ -9,23 +9,32 @@ stdenv.mkDerivation {
- installPhase = ''
- 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
- + 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
- export CARGO_HOME=$(mktemp -d cargo-home.XXX)
- ${cargoUpdateHook}
- - cargo vendor
- + cargo vendor > config
- +
- + LINENUMBER=$(grep -rne "\[source.vendored-sources\]" config | cut -d ':' -f 1)
- + sed -i -e "$LINENUMBER,+1d;" config
- +
- + cat <<EOF >> config
- + [source.vendored-sources]
- + directory = "$out"
- + EOF
- cp -ar vendor $out
- + cp config $out/config
- '';
- outputHashAlgo = "sha256";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement