-
-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Introduce your stance
In Nix Pills Chapter 8 - Generic Builders there is an error inside the example code.
Describe the issue
builder.sh
is shown to be:
set -e
unset PATH
for p in $buildInputs; do
export PATH=$p/bin${PATH:+:}$PATH
done
tar -xf $src
for d in *; do
if [ -d "$d" ]; then
cd "$d"
break
fi
done
./configure --prefix=$out
make
make install
and buildInputs
is empty and defined in `autotools.nix shown as:
pkgs: attrs:
let defaultAttrs = {
builder = "${pkgs.bash}/bin/bash";
args = [ ./builder.sh ];
baseInputs = with pkgs; [ gnutar gzip gnumake gcc coreutils gawk gnused gnugrep binutils.bintools ];
buildInputs = [];
system = builtins.currentSystem;
};
in
derivation (defaultAttrs // attrs)
When nix-build hello.nix
is run, it produces the error:
this derivation will be built:
/nix/store/54k0rivprkwmp1h238xwva2ca85liap9-hello.drv
building '/nix/store/54k0rivprkwmp1h238xwva2ca85liap9-hello.drv'...
/nix/store/86k2z0mc023y9qxn8gln4a6kj2a759gx-builder.sh: line 7: tar: No such file or directory
error: builder for '/nix/store/54k0rivprkwmp1h238xwva2ca85liap9-hello.drv' failed with exit code 127;
last 1 log lines:
> /nix/store/86k2z0mc023y9qxn8gln4a6kj2a759gx-builder.sh: line 7: tar: No such file or directory
For full logs, run 'nix log /nix/store/54k0rivprkwmp1h238xwva2ca85liap9-hello.drv'.
It occurs because PATH
variable defined in autotools.nix
stores paths contained in baseInputs
instead of buildInputs
so it cannot find the tar
executable coming from gnutar
.
To fix this either in the for
loop of builder.sh
ALSO baseInputs
along with buildInputs
or define gnutar
inside buildInputs = [];
of autotools.nix
file. Be free to choose the most elegant approach.
Page links
https://nixos.org/guides/nix-pills/generic-builders
Additional context
Add any other context about the problem here.
- I already created a Pull Request