deadnix
Scans .nix files for unused variable bindings — let bindings, lambda args, lambda pattern names, inherited values. Can auto-remove them in-place.
Usage
# scan current directory
nix run github:astro/deadnix -- .
# auto-fix in-place (commit first!)
nix run github:astro/deadnix -- -eq .Key flags
| Flag | Description |
|---|---|
-e / --edit | remove dead code in-place |
-f / --fail | exit 1 if dead code found (CI) |
-L / --no-lambda-pattern-names | skip pattern name checks — needed for nixpkgs callPackage |
-l / --no-lambda-arg | skip lambda argument checks |
-_ / --no-underscore | ignore bindings starting with _ |
-o json | machine-readable output |
--exclude | exclude specific files/paths |
Suppress a specific binding
# deadnix: skip
unusedThing = ...;