Now when I run nix-build in this folder, nothing happens. I am guessing this is because of the lazy nature of the nix language, and the fact that I’m not accessing the "13.6.0" key anywhere in order to evaluate that callPackage expression.
However, if I modify the code so that ./nodejs/default.nix looks like the following, then it does build a result link after a bunch of output:
So, it seems that the lazy feature is getting in the way of how I was imagining to organize my local packages.
What do you recommend? How would you organize this so laziness doesn’t get in the way? Suppose you want to run a shell with Node 13.6.0 available, how would you do it? Imagine that there are multiple keys like "12.3.0", '“13.4.0”`, etc.
nix-build will build either a top-level derivation, a list of derivations or an attribute set of derivations. However, it will not traverse the attrset recursively. Here you have something like this:
{
nodejs = {
"13.6.0" = <derivation>;
};
}
Knowing that, either run nix-build -A nodejs, or make the attrset a bit more shallow.