A static analysis tool that scans Nix files for dead code like unused variable bindings and lambda arguments.
deadnix is a static analysis tool for the Nix language that scans `.nix` files to identify dead code, such as unused variable bindings, lambda arguments, and inherit statements. It helps developers clean up their Nix codebases by detecting and optionally removing unnecessary declarations automatically.
Nix developers and system administrators who write or maintain Nix expressions and want to improve code quality by eliminating dead code.
It provides a specialized, automated way to enforce code cleanliness in Nix projects, with flexible configuration to handle edge cases like nixpkgs `callPackage` patterns and integration with popular workflows like pre-commit and GitHub Actions.
Scan Nix files for dead code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Identifies unused let bindings, lambda arguments, and inherit statements with line-specific ANSI-colored reports, as shown in the example output.
Offers an `--edit` flag to automatically remove dead code from source files, reducing manual refactoring effort, though users are cautioned to commit first.
Works with Nix Flakes via direct runs, GitHub Actions via deadnix-action, and pre-commit hooks, making it easy to embed in CI/CD pipelines.
Allows skipping checks for bindings starting with `_` or lambda patterns to avoid false positives in nixpkgs callPackage, demonstrated with `-L` and `-_` flags.
Requires manual flags like `--no-lambda-pattern-names` to handle common nixpkgs patterns, adding setup complexity in projects with complex import structures.
The `--edit` flag directly modifies source files, and the README warns to commit changes first, indicating potential for unintended data loss if misused.
Only scans `.nix` files, lacking support for other languages or IDE plugins, which restricts its utility in mixed-codebase environments.