Some nix
language gotchas I’ve experienced while using
NixOS personally:
- Avoid
with
expressions unless with theinherit
keyword for identifying hidden attributes in scope. - Avoid the
rec
keyword unless there’s tracking/control of infinite set recursion (self naming/references). - Avoid importing more than 1 instance of
<nixpkgs>
for any evaluation chain unless there’s magic compute and “infinite” memory.
Tricky is numero three, but crucial for fast feedback regardless of the current thing? I don’t poke around as much to know anymore but; legacy, flakes, community, and possibly others.