From 2546152ca025c7f3d22fd1e3c2eb85e96fa61093 Mon Sep 17 00:00:00 2001 From: Reno Dakota Date: Mon, 30 Dec 2024 10:37:55 +0000 Subject: [PATCH] rustfmt-nightly: add -headerpad_max_install_names x64 darwin fix failing install_name_tool not having enough space to write the path into the binary > error: install_name_tool: changing install names or rpaths can't be redone for: /nix/store/.../git-rustfmt (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names) --- pkgs/development/compilers/rust/rustfmt.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/compilers/rust/rustfmt.nix b/pkgs/development/compilers/rust/rustfmt.nix index bf41bcc2f018b..8f9d83d548c3e 100644 --- a/pkgs/development/compilers/rust/rustfmt.nix +++ b/pkgs/development/compilers/rust/rustfmt.nix @@ -33,6 +33,11 @@ rustPlatform.buildRustPackage rec { install_name_tool -add_rpath "${rustc.unwrapped}/lib" "$out/bin/git-rustfmt" ''; + env = lib.optionalAttrs (asNightly && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) { + # give install_name_tool enough space so preFixup doesn't fail + NIX_LDFLAGS = "-headerpad_max_install_names"; + }; + # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler RUSTC_BOOTSTRAP = 1;