Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 65 lines 2.3 kB view raw
1{ stdenv, file, curl, pkgconfig, python, openssl, cmake, zlib 2, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2 3, CoreFoundation, Security 4, version 5, patches ? [] 6, src }: 7 8rustPlatform.buildRustPackage rec { 9 name = "cargo-${version}"; 10 inherit version src patches; 11 12 # the rust source tarball already has all the dependencies vendored, no need to fetch them again 13 cargoVendorDir = "vendor"; 14 preBuild = "pushd src/tools/cargo"; 15 postBuild = "popd"; 16 17 passthru.rustc = rustc; 18 19 # changes hash of vendor directory otherwise 20 dontUpdateAutotoolsGnuConfigScripts = true; 21 22 nativeBuildInputs = [ pkgconfig ]; 23 buildInputs = [ cacert file curl python openssl cmake zlib makeWrapper libgit2 ] 24 ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ]; 25 26 LIBGIT2_SYS_USE_PKG_CONFIG=1; 27 28 # fixes: the cargo feature `edition` requires a nightly version of Cargo, but this is the `stable` channel 29 RUSTC_BOOTSTRAP=1; 30 31 # FIXME: Use impure version of CoreFoundation because of missing symbols. 32 # CFURLSetResourcePropertyForKey is defined in the headers but there's no 33 # corresponding implementation in the sources from opensource.apple.com. 34 preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' 35 export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" 36 ''; 37 38 postInstall = '' 39 # NOTE: We override the `http.cainfo` option usually specified in 40 # `.cargo/config`. This is an issue when users want to specify 41 # their own certificate chain as environment variables take 42 # precedence 43 wrapProgram "$out/bin/cargo" \ 44 --suffix PATH : "${rustc}/bin" \ 45 --set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \ 46 --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" 47 ''; 48 49 checkPhase = '' 50 # Disable cross compilation tests 51 export CFG_DISABLE_CROSS_TESTS=1 52 cargo test 53 ''; 54 55 # Disable check phase as there are failures (4 tests fail) 56 doCheck = false; 57 58 meta = with stdenv.lib; { 59 homepage = https://crates.io; 60 description = "Downloads your Rust project's dependencies and builds your project"; 61 maintainers = with maintainers; [ wizeman retrry ]; 62 license = [ licenses.mit licenses.asl20 ]; 63 platforms = platforms.unix; 64 }; 65}