-
Notifications
You must be signed in to change notification settings - Fork 54
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
formatting/general code style guidelines #23
Comments
the three most popular formatters are alejandrai'm personally a fan of alejandra and it's what i use in my nix stuff since it can make things look pretty good and it's aggressive enough with formatting so that the output is very consistent. it has some opinionated styling though, such as lists and attrs being formatted like this: _: {
list = [1 2 3 4];
attr = {foo = bar;};
} nixfmtnixfmt is probably the most traditional one, but in my experience it doesn't really format much at all. i feel like this is good for personal projects since it helps you clean up your own unique style, but maybe not the best for collaborative project. a lot of it's formatting lets personal style bleed through and it's easily the most conservative of the three. nixpkgs-fmtnixpkgs-fmt is the closest we have to a "standard" formatter since it's in nix-community and has seen pretty wide adoption by projects inside and outside of that group -- and like alejandra, it formats a lot of stuff sometimes. it's style is similar to nixfmt, though with the exception of some small things such as arguments being formatted like this: { pkgs
, config
, lib
, ...
}:
{} imo, nixpkgs-fmt or alejandra would be the best for this project since they create the most uniform code (plus they just look a bit better most of the time) |
I’m leaning toward nixpkgs-fmt just since it’s more standard in the community, so I’ll add it to CI. I’m still open to arguments for alejandra though. |
i like alejandra, but yeah i agree nixpkgs-fmt would be best for a collaborative project (plus it's just a formatter :p) |
Closed by #31 |
we've talked about this a lot, so i think it might be a good time to actually figure out what formatter we're going to use, and what (if any) code style guidelines we would want to put in CONTRIBUTING.md. a good example of how we could approach this is found here in the home-manager manual
The text was updated successfully, but these errors were encountered: