Stream: nix

Topic: nixfmt


view this post on Zulip Srid (Jun 14 2024 at 13:58):

@Pol Dellaiera Is nixfmt considered de facto/ stable now? Because the Github repo description says

The official (but not yet stable) formatter for Nix code

https://github.com/NixOS/nixfmt

view this post on Zulip Andreas (Jun 14 2024 at 14:01):

Apparently RFC 166 has established it to become the standard at least

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:01):

Yeah see this thingie: https://github.com/nix-community/nixvim/pull/1375#issuecomment-2039393789

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:01):

I'm requiring every contributor to pass their new Nix files through nixfmt-rfc-style since 1 month or so now.

view this post on Zulip Andreas (Jun 14 2024 at 14:02):

Good to know!

view this post on Zulip Srid (Jun 14 2024 at 14:02):

Pol Dellaiera said:

every contributor

Which repo? nixpkgs?

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:02):

Yes

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:02):

Last example today: https://github.com/NixOS/nixpkgs/pull/317742#pullrequestreview-2118391543

view this post on Zulip Srid (Jun 14 2024 at 14:04):

In services-flake we have a CI check that runs nixpkgs-fmt to see that the code was formatted, but I was surprised to see that it didn't fail on your PR (cc @Shivaraj B H)

https://github.com/juspay/services-flake/blob/db7ab711d9a6cefd28dbcfe58409d3a968a3b713/dev/flake.nix#L30

I'd welcome a dedicated PR that replaces nixpkgs-fmt with nixfmt-rfc-style mainly to see whether the new formatting is something we can switch over, not just for this project but for others as well. I've been happy with nixpkgs-fmt so far.

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:06):

I won't discuss the formatting, switch to nixfmt-rfc-style if you want to, that won't change a thing in the technical side of things. It's, I believe, up to the maintainers to decide.

view this post on Zulip Shivaraj B H (Jun 14 2024 at 14:06):

I don’t think nixpkgs-fmt flake check complaints about nixfmt-rfc-style, which is why the tests were passing.

view this post on Zulip Pol Dellaiera (Jun 14 2024 at 14:08):

I've already spent too much time discussing the code formatting in plenty of languages... and in the end, I always end up using the default one... even if I don't like some parts of it.

view this post on Zulip Andreas (Jun 14 2024 at 14:09):

yeah that is the best approach imho, just avoid useless discussion by establishing a formatting default


Last updated: Nov 15 2024 at 12:33 UTC