Now that we use the standard builder, the commands produced by
pre-configure.nix are wrapped in a bash function. Inside of a bash
function, `export foo=` will still add `foo` to the environment of
any child processes forked after that point, but those variables
will *not* be visible to bash code which is outside of the
function-scope in which the `export` occurs.
Weird crap like this is yet another reason why we need to move away
from using bash for logic. Let's switch.
The bash `declare` builtin works differently when it occurs inside
function, as it now does due to breaking up the monolithic
`builder.sh` into separate phases. We have to add `-g` in order to
get the outside-of-a-bash-function behavior when using `declare`
within a bash function.
This commit adds arguments to `builder.nix`, making it a callable
function, and splits up the single massive shell script into
separate attributes for each phase. It also drops the first two
lines and the last line because these are part of the default
builder.
All script lines which were not part of a phase function have been
moved into `preUnpack` since this is the first phase that runs.
Subsequent commits will move parts of this to more sensible
locations.
This commit performs two search-and-replace operations:
- replace all `${` with `''${`
- replace `''` with `""` in shell scripts
This commit is left unsquashed to make review of the subsequent
commits easier.
Remove the implicit dependency on `elixir` being somewhere in `PATH`.
Before:
```
$ nix build '.#elixir_1_15'
$ ./result/bin/mix --version
env: ‘elixir’: No such file or directory
```
After:
```
$ nix build '.#elixir_1_15'
$ ./result/bin/mix --version
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Mix 1.15.2 (compiled with Erlang/OTP 25)
```
This was caused by the shebang interpreter directive being set to
`${coreutils}/bin/env elixir`, whereas now the `elixir` part is replaced
with the full path to the interpreter.
We can't get rid of the `${coreutils}/bin/env` part, because without it
all scripts are interpreted as shell scripts.