The pedantic nix formatter
See the codepedantix is the pedantic Nix formatter.
It was bothering me that in my NixOS configuration, I was never consistent in ordering my module arguments, some being { lib, config, pkgs, ... } and some others being { config, lib, pkgs, ... }, you get the idea. Also I had grown tired of statix' repeated_keys error. Lastly, due to the nature of the nix language, I do not think there is much value in custom ordering of attributes except for in let bindings (I guess you could make a case for rec as well).
pedantix does this for you while staying compliant with your formatter of choice (tested with nixfmt(-rs), alejandra, and nixpkgs-fmt). I guess you can consider it a cherry on top :)
Here are some of its features (everything is optional):
(this will not modify your file, but only show you how it would look when formatted with pedantix)
nix run github:Swarsel/pedantix < your-file.nix
Rust
87.2%
Nix
9.8%
Emacs Lisp
2.9%
The pedantic nix formatter
See the codepedantix is the pedantic Nix formatter.
It was bothering me that in my NixOS configuration, I was never consistent in ordering my module arguments, some being { lib, config, pkgs, ... } and some others being { config, lib, pkgs, ... }, you get the idea. Also I had grown tired of statix' repeated_keys error. Lastly, due to the nature of the nix language, I do not think there is much value in custom ordering of attributes except for in let bindings (I guess you could make a case for rec as well).
pedantix does this for you while staying compliant with your formatter of choice (tested with nixfmt(-rs), alejandra, and nixpkgs-fmt). I guess you can consider it a cherry on top :)
Here are some of its features (everything is optional):
(this will not modify your file, but only show you how it would look when formatted with pedantix)
nix run github:Swarsel/pedantix < your-file.nix
Rust
87.2%
Nix
9.8%
Emacs Lisp
2.9%