-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix fmt's "formatter" attribute name is unclear so it gets used for non-nix files #9132
Comments
cc @roberth since you suggested an alternative attr already in #6087 (comment) |
Seems like users have found a useful command. Can't blame them. Technically we could make it appear more restrictive by passing a list of |
The only concern I have with just updating the documentation is if in the future |
If this is going to be a goal at any point, we better deprecate
|
Relevant: NixOS/rfcs#166
|
nix fmt is intended for formatting only .nix files, per both the man page and the long discussion when it was merged in #6087
It uses a generic sounding
formatter
attribute, which seems like a formatter for your flake, not a formatter for your flake's nix files. To learn that it isn't you have to know to check the docs for thenix fmt
command or go read the original PR.Since there's no mechanism to prevent it from formatting all files, there are usages in the wild which format all file types in a project. Example https://github.com/marigold-dev/pollinate/blob/1dcc46fa95b5e063e37cddbf0c5e4caccfffaf66/flake.nix#L30
The documentation should be changed to allow for formatting non-nix files, or the attribute should be renamed to make it much more obvious what the intent was.
See also #6241
The text was updated successfully, but these errors were encountered: