2019-11-02 22:27:34 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub
|
2019-11-06 19:23:32 +00:00
|
|
|
, rustPlatform, pkgconfig, openssl
|
|
|
|
# darwin dependencies
|
|
|
|
, Security, CoreFoundation, libiconv
|
|
|
|
}:
|
2019-11-02 22:27:34 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-geiger";
|
2020-01-30 02:40:49 +00:00
|
|
|
version = "0.9.1";
|
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-01-30 02:40:49 +00:00
|
|
|
sha256 = "0kvmjahyx5dcjhry2hkvcshi0lbgipfj0as74a3h3bllfvdfkkg0";
|
2019-11-02 22:27:34 +00:00
|
|
|
};
|
|
|
|
|
2020-03-09 01:06:49 +00:00
|
|
|
cargoSha256 = "0v50fkyf0a77l7whxalwnfqfi8lxy82z2gpd0fa0ib80qjla2n5z";
|
2020-01-30 02:40:49 +00:00
|
|
|
cargoPatches = [ ./cargo-lock.patch ];
|
2019-11-02 22:27:34 +00:00
|
|
|
|
2019-11-04 00:13:08 +00:00
|
|
|
# Multiple tests require internet connectivity, so they are disabled here.
|
|
|
|
# If we ever get cargo-insta (https://crates.io/crates/insta) in tree,
|
|
|
|
# we might be able to run these with something like
|
|
|
|
# `cargo insta review` in the `preCheck` phase.
|
|
|
|
checkPhase = ''
|
2020-02-18 10:46:50 +00:00
|
|
|
cd cargo-geiger/tests/snapshots
|
|
|
|
for file in *
|
|
|
|
do
|
|
|
|
mv $file r#$file
|
|
|
|
done
|
|
|
|
cd -
|
2019-11-04 00:13:08 +00:00
|
|
|
cargo test -- \
|
|
|
|
--skip test_package::case_2 \
|
|
|
|
--skip test_package::case_3 \
|
|
|
|
--skip test_package::case_6
|
|
|
|
'';
|
|
|
|
|
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; {
|
|
|
|
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 ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|