-
Notifications
You must be signed in to change notification settings - Fork 9
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
Nixfmt classic formatter #18
base: master
Are you sure you want to change the base?
Nixfmt classic formatter #18
Conversation
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.
Thanks for this. I should probably just bite the bullet and adopt the a standard formatter across all my nix code, this project included. I'll take a quick dive into the world of nix formatters this month because I'd like to get it right, but this PR will be a good starting point.
The actual result of this specific formatter feels a bit grating but I guess that's machine formatting for ya. It's worth it if it means everyone is aligned (basically like the golang ecosystem)
@@ -15,7 +15,8 @@ | |||
{ | |||
inputs = { | |||
# This has SBCL 2.4.10 and docktuil 3.1.3 which are known to work | |||
nixpkgs.url = "github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e"; | |||
nixpkgs.url = | |||
"github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e"; |
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.
I must say this feels like a regression..
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.
Sometimes it does break lines that I wish it wouldn't. I will leave justification for why this one in a regular comment.
I prefer I dislike Alejandra and RFC style for a few similar reasons, where the RFC style is far worse.
All of the above means code diffs are super noisy and change irrelevant lines per-commit. Alejandra has these problems, though to a much lesser degree compared to Infinisil's adopted project, so it would be my second choice. This PR is a prerequisite to other changes I would like to contribute. |
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.
You had me at Infinisil 👍
Hmm he does seem to advocate for -rfc though, not -classic. And I see this on their readme https://github.com/NixOS/nixfmt :
And apparently nixpkgs is going rfc style, I even commented on that discourse thread last year and completely forgot https://discourse.nixos.org/t/overview-of-nix-formatters-ecosystem/38880 😂 It seems like the numbers are in, and rfc-style has it. Do you see any significant adoption of -classic on the horizon? Because if I have to choose a formatter, and all of nixpkgs is going rfc, I'd rather follow them. If I'm going against the grain I'd rather not have a formatter at all. I don't find this one an improvement on its own right, the only benefit I see to this PR is to bring it in line with everyone else. |
All of this is true. I did not say "infinisil supports I suggest running both on a large portion of your own nix code and choosing for yourself.
|
gotcha thanks I'll try both and see |
This change sets the flake's formatter output to
nixfmt-classic
which is pretty close to your style.By submiting this PR, I agree to license this contribution under Creative Commons’ CC0 license.