2019-08-19 15:09:15 +02:00
|
|
|
{ stdenv, rustPlatform, Security }:
|
2019-08-16 12:26:51 +02:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "rustfmt";
|
2019-08-19 15:09:15 +02:00
|
|
|
inherit (rustPlatform.rust.rustc) version src;
|
2019-08-16 12:26:51 +02:00
|
|
|
|
|
|
|
# the rust source tarball already has all the dependencies vendored, no need to fetch them again
|
|
|
|
cargoVendorDir = "vendor";
|
|
|
|
preBuild = "pushd src/tools/rustfmt";
|
2019-08-19 12:54:40 +02:00
|
|
|
preInstall = "popd";
|
2019-08-16 12:26:51 +02:00
|
|
|
|
2019-08-19 15:23:41 +02:00
|
|
|
# changes hash of vendor directory otherwise
|
|
|
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
|
|
|
|
2019-08-16 12:26:51 +02:00
|
|
|
buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
|
|
|
|
|
|
|
|
# As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
2019-08-19 15:09:15 +02:00
|
|
|
# we run tests in debug mode so tests look for a debug build of
|
|
|
|
# rustfmt. Anyway this adds nearly no compilation time.
|
|
|
|
preCheck = ''
|
|
|
|
cargo build
|
|
|
|
'';
|
2019-08-16 12:26:51 +02:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A tool for formatting Rust code according to style guidelines";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/rust-lang-nursery/rustfmt";
|
2019-08-16 12:26:51 +02:00
|
|
|
license = with licenses; [ mit asl20 ];
|
|
|
|
maintainers = with maintainers; [ globin basvandijk ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|