removeReferencesTo: unbreak when __structuredAttrs is enabled

When `__structuredAttrs` is enabled, the `remove-references-to` script
ends up being built with a shebang of `#!@shell@` (among other, Darwin-
specific, breakages), as `$shell` isn't defined.

A small interlude: the eagle-eyed stdenv knowers reading this may be
thinking to themselves, "Doesn't stdenv set `$shell` if it's not
defined?" This is true... *but* consider the state of this file before
this change: it had `shell` as an argument to `mkDerivation`, and
arguments to `mkDerivation` get defined as *Bash variables*. So, when
stdenv was checking to see if `$shell` was defined, it was looking at
the *Bash variable* and not the environment variable.
This commit is contained in:
Winter
2025-05-11 00:39:10 -04:00
parent f6ddb809c4
commit 262532f409
@@ -34,8 +34,10 @@ stdenv.mkDerivation {
substituteAll ${./darwin-sign-fixup.sh} $out/nix-support/setup-hooks.sh
'';
inherit (builtins) storeDir;
shell = lib.getBin shell + (shell.shellPath or "");
signingUtils = if darwinCodeSign then signingUtils else null;
env = {
inherit (builtins) storeDir;
shell = lib.getBin shell + (shell.shellPath or "");
} // lib.optionalAttrs darwinCodeSign { inherit signingUtils; };
meta.mainProgram = "remove-references-to";
}