From 6057da3eeab871ffb1af89e06707eca0ff4adff5 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sun, 25 Jan 2026 13:38:09 -0500 Subject: [PATCH] makeBinaryWrapper: fix passthru.extractCmd on darwin On darwin, strings does not support -d. Regardless of darwin, the generated extract script has `strings` without a full nix store path, making it potentially impure. The solution is to always pull `strings` from GNU toolchain, regardless of the platform. Note: this change should have no implications for darwin bootstrap because `passthru.extractCmd` has very limited use in the tree, basically only used when building Firefox, and is not evaluated otherwise. Note: previous attempt to resolve the issue was incorrect, effectively doing nothing on Darwin, see #379014. (The `targetPackages.gnuStdenv.cc.bintools.targetPrefix` was empty.) --- pkgs/by-name/ma/makeBinaryWrapper/package.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ma/makeBinaryWrapper/package.nix b/pkgs/by-name/ma/makeBinaryWrapper/package.nix index 749851d547e2..fd51da369068 100644 --- a/pkgs/by-name/ma/makeBinaryWrapper/package.nix +++ b/pkgs/by-name/ma/makeBinaryWrapper/package.nix @@ -24,9 +24,13 @@ makeSetupHook { passthru = { # Extract the function call used to create a binary wrapper from its embedded docstring - extractCmd = writeShellScript "extract-binary-wrapper-cmd" '' - ${targetPackages.gnuStdenv.cc.bintools.targetPrefix}strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p' - ''; + extractCmd = + let + bintools = targetPackages.gnuStdenv.cc.bintools; + in + writeShellScript "extract-binary-wrapper-cmd" '' + ${lib.getExe' bintools "${bintools.targetPrefix}strings"} -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p' + ''; tests = tests.makeBinaryWrapper; };