When cross-compiling, patchShebangs requires the host platform's bash
to be present in the HOST_PATH environment variable. However, when
using pkgs.runCommand, only the build platform's bash is added to the
PATH. The result is that the shebang is not replaced, and the script
fails to run because the activation scripts don't have bash in their
environment.
Using an explicit mkDerivation lets us add the host bash as a
buildInput, which makes patchShebangs work as expected.
For context, I'm using impermanence on a Raspberry Pi 0. Since no
binary cache exists for that platform, I cross-compile the entire OS and
configuration from an x86_64 host and only push the resulting closure.
When cross-compiling,
patchShebangs
requires the host platform's bash to be present in the HOST_PATH environment variable. However, when usingpkgs.runCommand
, only the build platform's bash is added to the PATH. The result is that the shebang is not replaced, and the script fails to run because the activation scripts don't havebash
in their environment.Using an explicit
mkDerivation
lets us add the host bash as abuildInput
, which makespatchShebangs
work as expected.For context, I'm using impermanence on a Raspberry Pi 0. Since no binary cache exists for that platform, I cross-compile the entire OS and configuration from an x86_64 host and only push the resulting closure.