3 ms·
Unless I'm misunderstanding how it all works, it's just attrsets underneath. Like JSON objects with some semantics given to them - and those (and their YAML cou
by drdaeman 2y ago
Unless I'm misunderstanding how it all works, it's just attrsets underneath. Like JSON objects with some semantics given to them - and those (and their YAML counterparts) are not exactly great. In particular, I believe (I could be wrong here) this results in sometimes hard-to-understand error traces if something gets messed up.
- soraminazuki 2y agoThe module system type checks each attribute in a attrset. It merges all modules, ensures there are no conflicts, type checks and returns the resulting attrset. Error messages indicate the offending option definition along with its location in the case of conflicts or type errors, which should be enough for enough for debugging.
- drdaeman 2y agoI vaguely remember shooting myself in my foot by doing some weird stuff with deep attrset transformations, where I managed to screw-up those "special" attrsets by making a mistake in a function that tried to build module options dynamically from another "transplant" module's options. Surely, that was weird stuff, and sadly I don't have a history of what exactly I did back then (it was couple years ago), but I remember having to introspect with Nix REPL to understand where I messed up. I would've loved it more if Nix had ability to create custom types, ideally GADTs. Tagged attrsets work for sure, but a better type system would've probably made things easier and nicer.