You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collapse single-definitions or Group multiple definitions #328
Even ignoring our policy of not doing syntax normalization, this also is a non-starter because of the Nix language syntax. Your examples of expected output are trivial, but real code contains comments and unrelated attributes between attributes to be merged, and such a feature would expose users to spooky action at a distance when formatting. Even worse, in Nix, attribute merging is a complete utter mess, and touching the attributes in any non-trivial way would require Nixfmt to re-implement the cursed syntax in a bug-compatible manner (and failure to correctly do so would result in accidental breaking semantic changes)
Activity
MattSturgeon commentedon Aug 21, 2025
I believe we would consider this a "syntax transformation" similar to #321 (comment)
Generally speaking, these are out of scope for nixfmt. Although there are nix linters out there, some of which may suggest these kinda changes.
piegamesde commentedon Aug 22, 2025
Even ignoring our policy of not doing syntax normalization, this also is a non-starter because of the Nix language syntax. Your examples of expected output are trivial, but real code contains comments and unrelated attributes between attributes to be merged, and such a feature would expose users to spooky action at a distance when formatting. Even worse, in Nix, attribute merging is a complete utter mess, and touching the attributes in any non-trivial way would require Nixfmt to re-implement the cursed syntax in a bug-compatible manner (and failure to correctly do so would result in accidental breaking semantic changes)
* merge `nix.settings.*` into the nested attr like NixOS/nixfmt#328 @…