-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nix Pills - error in example code - Chapter 8 - Generic Builders #225
Comments
I think that the problem with the code above is that the suggested exercise hasn't been completed yet - please see this section of the page:
please see here below a set -e
unset PATH
for p in $baseInputs $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 let
pkgs = import <nixpkgs> {};
mkDerivation = import ./autotools.nix pkgs;
in
mkDerivation {
name = "hello";
src = ./hello-2.12.1.tar.gz;
} and 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) running I think that it could be helpful to many people not to leave this exercise as an open point with no listed solution. I am thinking of adding some type of accordion/tip section to make sure that everyone converges on the solution, but I don't know how that can be achieved yet. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-12-11-documentation-team-meeting-notes-99/36866/1 |
So it's not:
|
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:and
buildInputs
is empty and defined in `autotools.nix shown as:When
nix-build hello.nix
is run, it produces the error:It occurs because
PATH
variable defined inautotools.nix
stores paths contained inbaseInputs
instead ofbuildInputs
so it cannot find thetar
executable coming fromgnutar
.To fix this either in the
for
loop ofbuilder.sh
ALSObaseInputs
along withbuildInputs
or definegnutar
insidebuildInputs = [];
ofautotools.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.
The text was updated successfully, but these errors were encountered: