Description
fixing the patchShebangs
script to respect cross compilation is incredibly important for reducing image size and build contamination. the script works by searching the build source for #! /path/to/binary
in executable files and then replacing that binary with one from $PATH
(which is populated with binaries from the nix store).
in this PR NixOS/nixpkgs#43833 (that was reverted) patchShebangs
works by populating $PATH
with binaries from buildInputs
(to get host binaries and not build-time binaries). this works exactly the same except in the case of bash
, which is never listed in buildInputs
and is always implicitly in $PATH
during non-cross builds (because of stdenv
).
therefore we need to add the runtimeShell
package as a buildInput
to every derivation so patchShebangs
can pick up on that package when doing its magic. this most likely means editing stdenv
to include that package in its default list of buildInputs
.