about summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
authorWinter <winter@winter.cafe>2023-02-17 00:04:21 -0500
committerWinter <winter@winter.cafe>2023-02-20 01:19:56 -0500
commit759bd7b26f363f4701cb9a44da578fcf4676f103 (patch)
tree0c82c55861febe26b46d7677a23e5db421a6fc5e /pkgs/development/compilers/rust
parent8be63c2f948c7329faba3becb39f7bf31f5082bb (diff)
downloadnixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar.gz
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar.bz2
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar.lz
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar.xz
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.tar.zst
nixlib-759bd7b26f363f4701cb9a44da578fcf4676f103.zip
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
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/clippy.nix9
1 files changed, 8 insertions, 1 deletions
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; {