rust-bindgen: use rustfmt-nightly

bindgen's tests rely on specific output from rustfmt that uses
unstable features, so breaks when we build rustfmt as stable.

Also, use a better way to specify the rustfmt executable.
This commit is contained in:
K900 2022-04-06 11:10:17 +03:00
parent ddef8a68cb
commit e5f5ad71ac

View File

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, rustPlatform, clang, rustfmt, writeTextFile
{ lib, fetchFromGitHub, rustPlatform, clang, rustfmt-nightly
, runtimeShell
, bash
}:
@ -25,23 +25,11 @@ rustPlatform.buildRustPackage rec {
'';
doCheck = true;
checkInputs =
let fakeRustup = writeTextFile {
name = "fake-rustup";
executable = true;
destination = "/bin/rustup";
text = ''
#!${runtimeShell}
shift
shift
exec "$@"
'';
};
in [
rustfmt
fakeRustup # the test suite insists in calling `rustup run nightly rustfmt`
clang
];
checkInputs = [ clang ];
# bindgen hardcodes rustfmt outputs that use nightly features
RUSTFMT = "${rustfmt-nightly}/bin/rustfmt";
preCheck = ''
# for the ci folder, notably
patchShebangs .