From 7bd3a3bd55dbb1792aa3ad5b773b73f2826c450f Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Fri, 23 Nov 2018 17:45:33 +0100 Subject: [PATCH 1/3] rustfmt: 0.9.0 -> 0.99.5 rustfmt 1.0 has been released, but requires a more recent rustc. --- pkgs/development/tools/rust/rustfmt/default.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/rust/rustfmt/default.nix b/pkgs/development/tools/rust/rustfmt/default.nix index b8585dace54..3fddba5d08e 100644 --- a/pkgs/development/tools/rust/rustfmt/default.nix +++ b/pkgs/development/tools/rust/rustfmt/default.nix @@ -2,16 +2,25 @@ rustPlatform.buildRustPackage rec { name = "rustfmt-${version}"; - version = "0.9.0"; + version = "0.99.5"; src = fetchFromGitHub { - owner = "rust-lang-nursery"; + owner = "rust-lang"; repo = "rustfmt"; rev = "${version}"; - sha256 = "12l3ff0s0pzhcf5jbs8wqawjk4jghhhz8j6dq1n5201yvny12jlr"; + sha256 = "1gx1bsyb0f94r3f88f1j3b4rcm2x6zppcfab1c5vgpsr2dr6ch28"; }; - cargoSha256 = "0gppki9mgx99xipapg36ydwk1bplygnz6sbyzbg46vhn10iggfwm"; + cargoSha256 = "1rs6jjm75ixxhrf8b3zn991xa5kfayxlf0b70zdx6wd4r6by7w2y"; + + # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler + RUSTC_BOOTSTRAP = 1; + + # 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 + ''; meta = with stdenv.lib; { description = "A tool for formatting Rust code according to style guidelines"; From c73f75dc5ef9875aa2832c74b05d067fdcc17985 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Fri, 23 Nov 2018 17:52:25 +0100 Subject: [PATCH 2/3] rust-bindgen: enable tests now that we have a recent enough rustfmt --- pkgs/development/tools/rust/bindgen/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix index 836003eeb73..5a1c2364a77 100644 --- a/pkgs/development/tools/rust/bindgen/default.nix +++ b/pkgs/development/tools/rust/bindgen/default.nix @@ -29,7 +29,7 @@ rustPlatform.buildRustPackage rec { chmod +x $out/bin/bindgen ''; - doCheck = false; # half the tests fail because our rustfmt is not nightly enough + doCheck = true; checkInputs = let fakeRustup = writeScriptBin "rustup" '' #!${stdenv.shell} @@ -42,6 +42,10 @@ rustPlatform.buildRustPackage rec { fakeRustup # the test suite insists in calling `rustup run nightly rustfmt` clang ]; + preCheck = '' + # for the ci folder, notably + patchShebangs . + ''; meta = with stdenv.lib; { description = "C and C++ binding generator"; From 1d63496e5d1eb4eab5dfa6b462afb227ebfdcb47 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Sat, 24 Nov 2018 00:43:52 +0100 Subject: [PATCH 3/3] rustfmt: fix build on darwin --- pkgs/development/tools/rust/rustfmt/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/rust/rustfmt/default.nix b/pkgs/development/tools/rust/rustfmt/default.nix index 3fddba5d08e..06a3862adae 100644 --- a/pkgs/development/tools/rust/rustfmt/default.nix +++ b/pkgs/development/tools/rust/rustfmt/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, rustPlatform }: +{ stdenv, fetchFromGitHub, rustPlatform, darwin }: rustPlatform.buildRustPackage rec { name = "rustfmt-${version}"; @@ -13,6 +13,9 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "1rs6jjm75ixxhrf8b3zn991xa5kfayxlf0b70zdx6wd4r6by7w2y"; + 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 RUSTC_BOOTSTRAP = 1;