3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/rust/cargo-geiger/default.nix
Benjamin Hipple eb11feaa0b treewide: change fetchCargoTarball default to opt-out
Changes the default fetcher in the Rust Platform to be the newer
`fetchCargoTarball`, and changes every application using the current default to
instead opt out.

This commit does not change any hashes or cause any rebuilds. Once integrated,
we will start deleting the opt-outs and recomputing hashes.

See #79975 for details.
2020-02-13 22:41:37 -08:00

53 lines
1.8 KiB
Nix

{ stdenv, lib, fetchFromGitHub
, rustPlatform, pkgconfig, openssl
# darwin dependencies
, Security, CoreFoundation, libiconv
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-geiger";
version = "0.9.1";
src = fetchFromGitHub {
owner = "rust-secure-code";
repo = pname;
rev = "${pname}-${version}";
sha256 = "0kvmjahyx5dcjhry2hkvcshi0lbgipfj0as74a3h3bllfvdfkkg0";
};
# Delete this on next update; see #79975 for details
legacyCargoFetcher = true;
cargoSha256 = "0aykhhxk416p237safmqh5dhwjgrhvgc6zikkmxi9rq567ypp914";
cargoPatches = [ ./cargo-lock.patch ];
# 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 = ''
cargo test -- \
--skip test_package::case_2 \
--skip test_package::case_3 \
--skip test_package::case_6
'';
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/rust-secure-code/cargo-geiger;
license = with licenses; [ asl20 /* or */ mit ];
maintainers = with maintainers; [ evanjs ];
platforms = platforms.all;
};
}