@@ -1,7 +1,11 @@
11{ stdenv, fetchFromGitHub, file, curl, pkgconfig, python, openssl, cmake, zlib
22, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2, darwin
33, version, srcSha, cargoSha256
4−, patches ? []}:
4+, patches ? [] }:
5+
6+let
7+ inherit (darwin.apple_sdk.frameworks) CoreFoundation;
8+in
59
610rustPlatform.buildRustPackage rec {
711 name = "cargo-${version}";
@@ -21,13 +25,17 @@ rustPlatform.buildRustPackage rec {
2125
2226 nativeBuildInputs = [ pkgconfig ];
2327 buildInputs = [ file curl python openssl cmake zlib makeWrapper libgit2 ]
24− # FIXME: Use impure version of CoreFoundation because of missing symbols.
25− # CFURLSetResourcePropertyForKey is defined in the headers but there's no
26− # corresponding implementation in the sources from opensource.apple.com.
27− ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.CoreFoundation libiconv ];
28+ ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
2829
2930 LIBGIT2_SYS_USE_PKG_CONFIG=1;
3031
32+ # FIXME: Use impure version of CoreFoundation because of missing symbols.
33+ # CFURLSetResourcePropertyForKey is defined in the headers but there's no
34+ # corresponding implementation in the sources from opensource.apple.com.
35+ preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
36+ export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE"
37+ '';
38+
3139 postInstall = ''
3240 # NOTE: We override the `http.cainfo` option usually specified in
3341 # `.cargo/config`. This is an issue when users want to specify
@@ -36,8 +44,7 @@ rustPlatform.buildRustPackage rec {
3644 wrapProgram "$out/bin/cargo" \
3745 --suffix PATH : "${rustc}/bin" \
3846 --set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \
39− --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" \
40− ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''}
47+ --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt"
4148 '';
4249
4350 checkPhase = ''