switch from alejandra -> nixpkgs-fmt #12

Merged
Mic92 merged 1 commits from formatting into main 2023-07-21 09:15:48 +00:00
Owner

alejandra has someone questionable choices for formatting that no one would apply to there code if they would format manually.
nixpkgs-fmt seems to produce more readable results.

alejandra has someone questionable choices for formatting that no one would apply to there code if they would format manually. nixpkgs-fmt seems to produce more readable results.
Mic92 added 1 commit 2023-07-21 09:15:42 +00:00
alejandra has someone questionable choices for formatting that no one would apply to there code if they would format manually.
nixpkgs-fmt seems to produce more readable results.
Mic92 merged commit fb394f29ae into main 2023-07-21 09:15:48 +00:00
Mic92 deleted branch formatting 2023-07-21 09:15:52 +00:00
DavHau reviewed 2023-07-21 09:55:55 +00:00
DavHau left a comment
Owner

I do not want to start a fight about formatters but kindly want to express my disagreement.
I think some of the formatting patterns which nixpkgs adopted from the haskell world are bad for several reasons. Some of them are visible in this diff -> see comments blow.

Anyways, I'm fine with nixpkgs-fmt, if that's the preferred choice of the team.
Currently there is a lot of activity in RFC 101 where they now develop a proper formal standard for nix code formatting.

They currently test their rules on a branch if nixfmt.
I actually just tried it and the formatting choices seem to be a mix between alejandra and nixpkgs-fmt.
Once the standard is out we will have to re-format the whole thing again anyways I guess.

I do not want to start a fight about formatters but kindly want to express my disagreement. I think some of the formatting patterns which nixpkgs adopted from the haskell world are bad for several reasons. Some of them are visible in this diff -> see comments blow. Anyways, I'm fine with nixpkgs-fmt, if that's the preferred choice of the team. Currently there is a lot of activity in [RFC 101](https://github.com/NixOS/rfcs/pull/101) where they now develop a proper formal standard for nix code formatting. They currently test their rules on [a branch if nixfmt](https://github.com/serokell/nixfmt/pull/118). I actually just tried it and the formatting choices seem to be a mix between alejandra and nixpkgs-fmt. Once the standard is out we will have to re-format the whole thing again anyways I guess.
@ -4,1 +1,3 @@
...
{ self
, inputs
, ...
Owner

Not sure if that is better? The lines are not conform and start with different characters. You cannot simply re-order the lines without breaking stuff for example.

Not sure if that is better? The lines are not conform and start with different characters. You cannot simply re-order the lines without breaking stuff for example.
@ -7,3 +6,3 @@
inputs.treefmt-nix.flakeModule
];
perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: {
Owner

Is that really more readable or just more to type?

Is that really more readable or just more to type?
@ -21,0 +16,4 @@
, config
, self
, ...
}: {
Owner

Is this indentation preferable?

Is this indentation preferable?
Author
Owner

fixed in #14

fixed in https://git.clan.lol/clan/clan-core/pulls/14
@ -5,0 +2,4 @@
, system ? builtins.currentSystem
,
}:
let
Owner

and this?

and this?
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: clan/clan-core#12
No description provided.