Merge pull request #66713 from basvandijk/rustfmt-from-rust-src

rustfmt: use the src as defined by the git submodule in rust
This commit is contained in:
Bas van Dijk 2019-08-19 15:14:23 +02:00 committed by GitHub
commit b9c4bef090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 13 deletions

View File

@ -59,6 +59,7 @@
pkgsBuildHost = pkgsBuildBuild // { targetPackages.stdenv = llvmPackages_5.stdenv; }; pkgsBuildHost = pkgsBuildBuild // { targetPackages.stdenv = llvmPackages_5.stdenv; };
pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmPackages_5.stdenv; }; pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmPackages_5.stdenv; };
}); });
rustfmt = self.callPackage ./rustfmt.nix { inherit Security; };
cargo = self.callPackage ./cargo.nix { cargo = self.callPackage ./cargo.nix {
# Use boot package set to break cycle # Use boot package set to break cycle
rustPlatform = bootRustPlatform; rustPlatform = bootRustPlatform;

View File

@ -1,19 +1,15 @@
{ stdenv, fetchFromGitHub, rustPlatform, darwin }: { stdenv, rustPlatform, Security }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
name = "rustfmt-${version}"; name = "rustfmt-${version}";
version = "1.2.2"; inherit (rustPlatform.rust.rustc) version src;
src = fetchFromGitHub { # the rust source tarball already has all the dependencies vendored, no need to fetch them again
owner = "rust-lang"; cargoVendorDir = "vendor";
repo = "rustfmt"; preBuild = "pushd src/tools/rustfmt";
rev = "v${version}"; preInstall = "popd";
sha256 = "1k9p6sp8q87flx9vzg46880ir7likvbydai3g6q76278h86rn0v8";
};
cargoSha256 = "08x6vy5v2vgrk3gsw3qcvv52a7hifsgcsnsg1phlk1ikaff21y4z"; buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
# As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
RUSTC_BOOTSTRAP = 1; RUSTC_BOOTSTRAP = 1;
@ -28,7 +24,7 @@ rustPlatform.buildRustPackage rec {
description = "A tool for formatting Rust code according to style guidelines"; description = "A tool for formatting Rust code according to style guidelines";
homepage = https://github.com/rust-lang-nursery/rustfmt; homepage = https://github.com/rust-lang-nursery/rustfmt;
license = with licenses; [ mit asl20 ]; license = with licenses; [ mit asl20 ];
maintainers = [ maintainers.globin ]; maintainers = with maintainers; [ globin basvandijk ];
platforms = platforms.all; platforms = platforms.all;
}; };
} }

View File

@ -8279,7 +8279,7 @@ in
rls = callPackage ../development/tools/rust/rls { rls = callPackage ../development/tools/rust/rls {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
}; };
rustfmt = callPackage ../development/tools/rust/rustfmt { }; rustfmt = rustPackages.rustfmt;
rustracer = callPackage ../development/tools/rust/racer { rustracer = callPackage ../development/tools/rust/racer {
inherit (darwin.apple_sdk.frameworks) Security; inherit (darwin.apple_sdk.frameworks) Security;
}; };