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