I begin to better understand the nix language and functional programming. And so I try to write more elaborated code.
But how to debug when it doesn’t build ?
For example, if I have this kind of code
let
myFunc = var: ( # some elaborated code I'm proud of );
mySet = builtins.listToAttr (builtins.map myFunc [ "a" "b" "c" ]);
in
{
some.configuration = mySet;
}
and if my build fails because there’s something wrong with mySet, is there a way to display the value of mySet (some kind of var dump ?).
There’s also a relatively new flag called --debugger that launches an interactive debugger at the point where an evaluation failed (or at a breakpoint that can be set via builtins.break IIRC).
Btw if your code above is the problem, the function you’re most likely looking for is builtins.listToAttrs (notice the plural attrs ;-))