-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
flake: configure nix fmt #325575
flake: configure nix fmt #325575
Conversation
Signed-off-by: lucasew <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah as @superherointj explains, it doesn't really make sense to do this right now. The next step is to format (pretty much) all of Nixpkgs and enforce it for all new files with CI, like I'm doing in #322537. Even after that we still can't have nix fmt
, because there's going to be PRs that get merged with unformatted files for a while still (because CI doesn't run unless you update a PR). This should fizzle out over the following weeks/months though, and at some point there won't be any PRs that haven't been running with CI that enforces formatting, at which point we can fully enforce it and use nix fmt
:)
Beyond that, there's other minor problems with this:
nix fmt
is too slow, we should prefertreefmt
, which caches results and works in parallel- We need to use the pinned
nixfmt
version, see theshell.nix
file added in Development shell with a pinned nixfmt #322512
Right now there is PR reviews asking the contributors to format the code using the formatter. My intention for this PR is just to make it easier to run this formatting step. The whole repo is not fully formatted today because, as you said, there are some stuff still to be decided. I think until there this can be a little more informal, like, format new stuff now. BTW about ops, I'd suggest doing it like how it's done with EditorConfig, a CI step that then can take it's 40s without issues just to warn the contributor that stuff is not formatted. No precommit hooks. It would be simpler, and can be out of scope of this PR. |
#322537 is not far from being done, at which point there will be CI that takes some time until it tells the user about what files need to be formatted :) Btw would be great for anybody that wants to help out with this to join the Nix Formatting Matrix room. And for such PRs, please ping the @NixOS/nix-formatting team :D |
I guess this should be closed then |
Description of changes
Sets up the flake attribute that Nix uses in the
nix fmt
subcommand to use the RFC 166 Nix formatter.Nixpkgs has a handful of formatters, this PR basically just make it explicit which is the right one for the project.
cc NixOS/rfcs#166
Signed-off-by: lucasew [email protected]
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.