From 759bd7b26f363f4701cb9a44da578fcf4676f103 Mon Sep 17 00:00:00 2001 From: Winter Date: Fri, 17 Feb 2023 00:04:21 -0500 Subject: [PATCH] clippy: fix on darwin As of Rust 1.67.0, the cargo-clippy binary now relies on the rustc_private libraries [0], so let's do the RPATH fixup to it too. I've also added a comment to explain the RPATH situation, as it took me a bit to figure out. [0]: https://github.com/rust-lang/rust-clippy/pull/9541 --- pkgs/development/compilers/rust/clippy.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/rust/clippy.nix b/pkgs/development/compilers/rust/clippy.nix index 23b8e7effe12..8edec88a9192 100644 --- a/pkgs/development/compilers/rust/clippy.nix +++ b/pkgs/development/compilers/rust/clippy.nix @@ -20,8 +20,15 @@ rustPlatform.buildRustPackage { # (/private/tmp/nix-build-clippy-1.36.0.drv-0/rustc-1.36.0-src/src/librustc_llvm) doCheck = false; + # Clippy uses the rustc_driver and std private libraries, and Rust's build process forces them to have + # an install name of `@rpath/...` [0] [1] instead of the standard on macOS, which is an absolute path + # to itself. + # + # [0]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/src/bootstrap/builder.rs#L1543 + # [1]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/compiler/rustc_codegen_ssa/src/back/linker.rs#L323-L331 preFixup = lib.optionalString stdenv.isDarwin '' - install_name_tool -add_rpath "${rustc}/lib" $out/bin/clippy-driver + install_name_tool -add_rpath "${rustc}/lib" "$out/bin/clippy-driver" + install_name_tool -add_rpath "${rustc}/lib" "$out/bin/cargo-clippy" ''; meta = with lib; {