1{ lib, 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 buildAndTestSubdir = "src/tools/rustfmt";
10
11 # changes hash of vendor directory otherwise
12 dontUpdateAutotoolsGnuConfigScripts = true;
13
14 buildInputs = lib.optional stdenv.isDarwin Security;
15
16 # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
17 RUSTC_BOOTSTRAP = 1;
18
19 # As of rustc 1.45.0, these env vars are required to build rustfmt (due to
20 # https://github.com/rust-lang/rust/pull/72001)
21 CFG_RELEASE = "${rustPlatform.rust.rustc.version}-nightly";
22 CFG_RELEASE_CHANNEL = "nightly";
23
24 meta = with lib; {
25 description = "A tool for formatting Rust code according to style guidelines";
26 homepage = "https://github.com/rust-lang-nursery/rustfmt";
27 license = with licenses; [ mit asl20 ];
28 maintainers = with maintainers; [ globin basvandijk ];
29 };
30}