1{ stdenv, rustPlatform, Security }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "rustfmt";
5 inherit (rustPlatform.rust.rustc) version src;
6
7 # the rust source tarball already has all the dependencies vendored, no need to fetch them again
8 cargoVendorDir = "vendor";
9 preBuild = "pushd src/tools/rustfmt";
10 preInstall = "popd";
11
12 # changes hash of vendor directory otherwise
13 dontUpdateAutotoolsGnuConfigScripts = true;
14
15 buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
16
17 # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
18 RUSTC_BOOTSTRAP = 1;
19
20 # we run tests in debug mode so tests look for a debug build of
21 # rustfmt. Anyway this adds nearly no compilation time.
22 preCheck = ''
23 cargo build
24 '';
25
26 meta = with stdenv.lib; {
27 description = "A tool for formatting Rust code according to style guidelines";
28 homepage = https://github.com/rust-lang-nursery/rustfmt;
29 license = with licenses; [ mit asl20 ];
30 maintainers = with maintainers; [ globin basvandijk ];
31 platforms = platforms.all;
32 };
33}