cargo: Force usage of pkgs.cacert.

This commit is contained in:
Moritz Ulrich 2016-08-08 15:55:26 +02:00
parent 3cfe3ab6b6
commit 57a690fbe4
2 changed files with 23 additions and 9 deletions

View file

@ -1,6 +1,7 @@
{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib
, makeWrapper, libiconv, cacert, rustPlatform, rustc
, version, srcRev, srcSha, depsSha256 }:
, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2
, version, srcRev, srcSha, depsSha256
, patches ? []}:
rustPlatform.buildRustPackage rec {
name = "cargo-${version}";
@ -13,11 +14,14 @@ rustPlatform.buildRustPackage rec {
};
inherit depsSha256;
inherit patches;
passthru.rustc = rustc;
buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]
++ stdenv.lib.optional stdenv.isDarwin libiconv;
buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper libgit2 ]
++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
LIBGIT2_SYS_USE_PKG_CONFIG=1;
configurePhase = ''
./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.rust.cargo}/bin/cargo
@ -37,9 +41,14 @@ rustPlatform.buildRustPackage rec {
"$out/lib/rustlib/uninstall.sh" \
"$out/lib/rustlib/manifest-cargo"
# NOTE: We override the `http.cainfo` option usually specified in
# `.cargo/config`. This is an issue when users want to specify
# their own certificate chain as environment variables take
# precedence
wrapProgram "$out/bin/cargo" \
--suffix PATH : "${rustc}/bin" \
--run "export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" \
--set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \
--set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" \
${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''}
'';

View file

@ -23,10 +23,15 @@ rec {
};
cargo = callPackage ./cargo.nix rec {
version = "0.11.0";
srcRev = "refs/tags/${version}";
srcSha = "0ic2093bmwiw6vl2l9yhip87ni6dbz7dhrizy9wdx61229k16hc4";
depsSha256 = "0690sgn6fcay7sazlmrbbn4jbhnvmznrpz5z3rvkbaifkjrg4w6d";
# TODO: We're temporarily tracking master here as Darwin needs the
# `http.cainfo` option from .cargo/config which isn't released
# yet.
version = "master-2016-07-25";
srcRev = "f09ef68cc47956ccc5f99212bdcdd15298c400a0";
srcSha = "1r6q9jd0fl6mzhwkvrrcv358q2784hg51dfpy28xgh4n61m7c155";
depsSha256 = "1p1ygabg9k9b0azm0mrx8asjzdi35c5zw53iysba198lli6bhdl4";
inherit rustc; # the rustc that will be wrapped by cargo
inherit rustPlatform; # used to build cargo
};