Here’s a list of linters I’ve found for Nix. Feel free to reply with any I’ve missed.
I’ve added some comments saying what I find unique about some of them.
List of linting tools for Nix
- statix
- Source: GitHub - nerdypepper/statix: lints and suggestions for the nix programming language
- Nixpkgs attribute:
statix
- Flake URI:
github:NixOS/nixpkgs#statix
- Pretty output
- nix-lint
- Source: Supposedly GitHub - Warbo/nix-lint: Mirror of http://chriswarbo.net/git/nix-lint.git, but that’s unavailable,
mirror at GitHub - Warbo/nix-lint: Mirror of http://chriswarbo.net/git/nix-lint.git - Highly minimal, no batch processing or other niceties
- Source: Supposedly GitHub - Warbo/nix-lint: Mirror of http://chriswarbo.net/git/nix-lint.git, but that’s unavailable,
- nixpkgs-lint
- Source: GitHub - nix-community/nixpkgs-lint: A fast semantic linter for Nix using tree-sitter 🌳 + ❄️. [maintainers=@Artturin,@siraben]
- Flake URI:
github:nix-community/nix-lint
- Uses JavaScript & is meant for nixpkgs specifically
- nix-linter
- Source: GitHub - Synthetica9/nix-linter: Linter for the Nix expression language
- Nixpkgs attribute:
nix-linter
- Flake URI:
github:NixOS/nixpkgs#nix-linter
- Seems the most popular
- nixpkgs-hammering
- Source: GitHub - jtojnar/nixpkgs-hammering: Beat your package expressions into a shape
- Flake URI:
github:jtojnar/nixpkgs-hammering
- Specifically for nixpkgs packages
- nixpkgs-lint
- Source: nixpkgs/maintainers/scripts/nixpkgs-lint.pl at master · NixOS/nixpkgs · GitHub
- Nixpkgs attribute:
nixpkgs-lint
- Flake URI:
github:NixOS/nixpkgs#nixpkgs-lint
- Built into and specifically for nixpkgs
- nil
- Source: GitHub - oxalica/nil: NIx Language server, an incremental analysis assistant for writing in Nix.
- Nixpkgs attribute
nil
- Flake URI:
github:oxalica/nil#
- This is a language server, not a linter, but it does provide lints
- nixd
- Source: GitHub - nix-community/nixd: Nix language server, based on nix libraries [maintainer=@inclyc]
- Nixpkgs attribute:
nixd
- Flake URI:
github:nix-community/nixd#
- This is a language server, not a linter. I haven’t checked if it provides lints.
- deadnix
- Source: GitHub - astro/deadnix: Scan Nix files for dead code
- Nixpkgs attribute:
deadnix
- Flake URI:
github:astro/deadnix#
- Scans for dead code (unused variable bindings) in Nix files