Hi,
In Nix pill 7.2, the text suggests that building the builder.sh script
declare -xp
echo foo > $out
with the derivation
d = derivation { name = "foo"; builder = "${bash}/bin/bash"; args = [ ./builder.sh ]; system = builtins.currentSystem; }
will produce an output :
these derivations will be built: /nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv building '/nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv'... declare -x HOME="/homeless-shelter" declare -x NIX_BUILD_CORES="4" declare -x NIX_BUILD_TOP="/tmp/nix-build-foo.drv-0" declare -x NIX_LOG_FD="2" declare -x NIX_STORE="/nix/store" declare -x OLDPWD declare -x PATH="/path-not-set" declare -x PWD="/tmp/nix-build-foo.drv-0" declare -x SHLVL="1" declare -x TEMP="/tmp/nix-build-foo.drv-0" declare -x TEMPDIR="/tmp/nix-build-foo.drv-0" declare -x TMP="/tmp/nix-build-foo.drv-0" declare -x TMPDIR="/tmp/nix-build-foo.drv-0" declare -x builder="/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash" declare -x name="foo" declare -x out="/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo" declare -x system="x86_64-linux" warning: you did not specify '--add-root'; the result might be removed by the garbage collector /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo this derivation produced the following outputs: out -> /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo
When I execute the steps in the instructions, I just get a message
this derivation produced the following results
out -> /nix/store/<hash>-foo
Where the derivation just contains foo
.
I’m curious why
- The output I get differs from what the instructions suggest it should be, and
- Why
declare -xp
is used at all in the pill. It doesn’t do anything with the declared items, and although I’m a total bash pleb, they don’t seem to be accessible in the builder script. Replacingecho foo > $out
withecho $XDG_SEAT > $out
or some other variable in the output ofdeclare -xp
gives me a blank output after building.
Thanks for any help.