2019-08-15 14:13:01 +00:00
|
|
|
{ stdenv, lib, rustPlatform, rustc, Security, patchelf }:
|
2019-08-13 21:52:01 +00:00
|
|
|
rustPlatform.buildRustPackage {
|
2019-08-15 14:13:01 +00:00
|
|
|
name = "clippy-${rustc.version}";
|
|
|
|
inherit (rustc) version src;
|
|
|
|
|
|
|
|
# the rust source tarball already has all the dependencies vendored, no need to fetch them again
|
|
|
|
cargoVendorDir = "vendor";
|
2020-05-12 23:28:24 +00:00
|
|
|
buildAndTestSubdir = "src/tools/clippy";
|
2019-08-15 14:13:01 +00:00
|
|
|
|
|
|
|
# changes hash of vendor directory otherwise
|
|
|
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
buildInputs = [ rustc rustc.llvm ] ++ lib.optionals stdenv.isDarwin [ Security ];
|
2019-08-15 14:13:01 +00:00
|
|
|
|
|
|
|
# fixes: error: the option `Z` is only accepted on the nightly compiler
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
|
|
|
# Without disabling the test the build fails with:
|
|
|
|
# error: failed to run custom build command for `rustc_llvm v0.0.0
|
|
|
|
# (/private/tmp/nix-build-clippy-1.36.0.drv-0/rustc-1.36.0-src/src/librustc_llvm)
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isDarwin ''
|
2019-08-15 14:13:01 +00:00
|
|
|
install_name_tool -add_rpath "${rustc}/lib" $out/bin/clippy-driver
|
|
|
|
'';
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-02-18 01:58:48 +00:00
|
|
|
homepage = "https://rust-lang.github.io/rust-clippy/";
|
2019-08-15 14:13:01 +00:00
|
|
|
description = "A bunch of lints to catch common mistakes and improve your Rust code";
|
|
|
|
maintainers = with maintainers; [ basvandijk ];
|
|
|
|
license = with licenses; [ mit asl20 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|