I like having consistent ordering so I can quickly locate the things I need to change. We should also mention rationales for the more controversial parts – for example, the one per line rule is to make git diffs, as well as merges cleaner.
I think adding that example should be enough, people are pretty good at pattern matching. And adding an opinionated second level to nixkpgs-fmt would help a lot. Ideally, people should not have to think about this much.
Regarding the actual ordering, I like to order the attributes in meta alphabetically. Thankfully, it keeps the common one reasonably ordered (project info on top, nixpkgs-only stuff on the bottom, though the platforms kind of belong to the project too, now that I am thinking about it).
Few more things we might want to show in the example:
-
fetchFromGitHub (though the ordering of arguments is pretty intuitive)
-
environment variables like
NIX_CXX_FLAGS
(__structuredAttrs
will mandate placing them intoenv
attribute)