2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub
|
2021-02-05 17:12:51 +00:00
|
|
|
, rustPlatform, pkg-config, openssl
|
2020-12-09 12:39:15 +00:00
|
|
|
# testing packages
|
|
|
|
, cargo-insta
|
2020-04-24 23:36:52 +00:00
|
|
|
# darwin dependencies
|
|
|
|
, Security, CoreFoundation, libiconv
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-geiger";
|
2020-12-09 12:39:15 +00:00
|
|
|
version = "0.10.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-secure-code";
|
|
|
|
repo = pname;
|
|
|
|
rev = "${pname}-${version}";
|
2020-12-09 12:39:15 +00:00
|
|
|
sha256 = "1z920p8i3gkjadyd6bqjk4i5yr5ds3m3sbcnf7plcqr69dsjr4b8";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
cargoSha256 = "1wf9758gyaxgyajjzy5phirg922n9wv0qmy67zjmxj56ayf0l9lm";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2020-12-09 12:39:15 +00:00
|
|
|
${cargo-insta}/bin/cargo-insta test
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security libiconv ];
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# 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.
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Detects usage of unsafe Rust in a Rust crate and its dependencies";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/rust-secure-code/cargo-geiger";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
|
|
maintainers = with maintainers; [ evanjs ];
|
|
|
|
};
|
|
|
|
}
|