NI

nixfmt & statix

Formatting with nixfmt-rfc-style and linting with statix for idiomatic Nix code

Details

Language / Topic
nixNix
Category
Linter / Formatter

Rules

balanced
- Use `nixfmt-rfc-style` (the RFC-48 canonical formatter) to format all `.nix` files — run `nixfmt --check` in CI to reject unformatted commits.
- Run `statix check .` to detect anti-patterns such as `with pkgs;` in module scope, `rec` attribute sets, and unnecessary `let` bindings.
- Use `deadnix .` to find and remove unused `let` bindings and function arguments before merging.
- Integrate formatting and linting as flake checks: expose them via `checks.${system}.formatting = pkgs.runCommand "fmt-check" {} "nixfmt --check ..."`.