NixOS Hello World Pill not working


I needed this tip (and some hours…):

to get the example from this Pill working:

Might be worth passing on to the maintainer…


I just tried the example pill as mentioned in that guide, with the contents of, simple.c, and simple.nix as listed in the link you gave. (I’m using nix 2.5 on macOS). I didn’t run into problems.

What changes did you need to make to get the example working for you?

The script references buildInputs not baseInputs. Easy unless you are a beginner…

Ah, in this pill? Section 8.3? If you search for $baseInputs, you’ll find:

Exercise: Complete the new by adding $baseInputs in the for loop together with $buildInputs . As you noticed, we passed that new variable in the derivation. Instead of merging buildInputs with the base ones, we prefer to preserve buildInputs as seen by the caller, so we keep them separated. Just a matter of choice.

1 Like

My mistake - but maybe also UX could somehow be better… Thanks all the same : ) Learning alot!

1 Like

The pills aren’t really intended for “beginners”, I believe, although I went there when first learning nix too. It just goes into far more detail than you need for getting to grips with nix, while not being very helpful with the things you need to know when working with nixpkgs (which will practically be most of what you do).

That said, there is a distinct lack of official beginner tutorial. I think the nix/nixpkgs docs put together make a more reasonable set:

That’s not saying the nix pills are not worth reading, there are some nice hints in there about callPackage, and of course having some knowledge about how it all works is good, but I think they’re best read after having written at least a handful of modules and packages, and becoming familiar with a decent portion of the nixpkgs lib.

1 Like