From cb581af6d5f34c50022032a223b7362af957e097 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Wed, 6 Nov 2019 11:23:32 -0800 Subject: [PATCH] cargo-geiger: fix darwin build --- .../tools/rust/cargo-geiger/default.nix | 15 ++++++++++++--- pkgs/top-level/all-packages.nix | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/rust/cargo-geiger/default.nix b/pkgs/development/tools/rust/cargo-geiger/default.nix index 2512a9ec4f4..70601faaf6d 100644 --- a/pkgs/development/tools/rust/cargo-geiger/default.nix +++ b/pkgs/development/tools/rust/cargo-geiger/default.nix @@ -1,6 +1,8 @@ { stdenv, lib, fetchFromGitHub -, rustPlatform, pkgconfig -, openssl, Security }: +, rustPlatform, pkgconfig, openssl +# darwin dependencies +, Security, CoreFoundation, libiconv +}: rustPlatform.buildRustPackage rec { pname = "cargo-geiger"; @@ -26,9 +28,16 @@ rustPlatform.buildRustPackage rec { --skip test_package::case_6 ''; - buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ]; + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security libiconv ]; nativeBuildInputs = [ pkgconfig ]; + # FIXME: Use impure version of CoreFoundation because of missing symbols. + # CFURLSetResourcePropertyForKey is defined in the headers but there's no + # corresponding implementation in the sources from opensource.apple.com. + preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" + ''; + meta = with lib; { description = "Detects usage of unsafe Rust in a Rust crate and its dependencies."; homepage = https://github.com/anderejd/cargo-geiger; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bab793823e9..5476aea81a1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8534,7 +8534,8 @@ in cargo-expand = callPackage ../development/tools/rust/cargo-expand { }; cargo-fuzz = callPackage ../development/tools/rust/cargo-fuzz { }; cargo-geiger = callPackage ../development/tools/rust/cargo-geiger { - inherit (darwin.apple_sdk.frameworks) Security; + inherit (darwin) libiconv; + inherit (darwin.apple_sdk.frameworks) Security CoreFoundation; }; cargo-inspect = callPackage ../development/tools/rust/cargo-inspect { inherit (darwin.apple_sdk.frameworks) Security;