rustfmt: wrap cargo-fmt with cargo (#291578)
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
{ lib, stdenv, rustPlatform, rustc, Security, asNightly ? false }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, cargo
|
||||
, makeWrapper
|
||||
, rustPlatform
|
||||
, rustc
|
||||
, Security
|
||||
, asNightly ? false
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "rustfmt" + lib.optionalString asNightly "-nightly";
|
||||
inherit (rustc) version src;
|
||||
|
||||
@@ -11,6 +19,10 @@ rustPlatform.buildRustPackage rec {
|
||||
# changes hash of vendor directory otherwise
|
||||
dontUpdateAutotoolsGnuConfigScripts = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
rustc.llvm
|
||||
] ++ lib.optional stdenv.hostPlatform.isDarwin Security;
|
||||
@@ -34,6 +46,11 @@ rustPlatform.buildRustPackage rec {
|
||||
CFG_RELEASE = rustc.version;
|
||||
CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable";
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/cargo-fmt \
|
||||
--suffix PATH : ${lib.makeBinPath [ cargo ]}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Tool for formatting Rust code according to style guidelines";
|
||||
homepage = "https://github.com/rust-lang-nursery/rustfmt";
|
||||
|
||||
Reference in New Issue
Block a user