Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Nix
  3. deadnix

deadnix

GPL-3.0Rust

A static analysis tool that scans Nix files for dead code like unused variable bindings and lambda arguments.

GitHubGitHub
793 stars20 forks0 contributors

What is deadnix?

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.

Target Audience

Nix developers and system administrators who write or maintain Nix expressions and want to improve code quality by eliminating dead code.

Value Proposition

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.

Overview

Scan Nix files for dead code

Use Cases

Best For

  • Cleaning up unused variables in large Nix codebases
  • Enforcing code quality standards in Nix projects
  • Automating dead code removal in CI/CD pipelines
  • Integrating static analysis into pre-commit hooks for Nix files
  • Optimizing Nix expressions by eliminating unnecessary bindings
  • Checking for dead code in nixpkgs overlays or custom packages

Not Ideal For

  • Projects heavily using nixpkgs callPackage without configuring exclusions manually
  • Teams preferring manual code audits over automated linting tools
  • Simple Nix scripts where dead code detection adds unnecessary overhead

Pros & Cons

Pros

Precise Dead Code Detection

Identifies unused let bindings, lambda arguments, and inherit statements with line-specific ANSI-colored reports, as shown in the example output.

Automated Cleanup Capability

Offers an `--edit` flag to automatically remove dead code from source files, reducing manual refactoring effort, though users are cautioned to commit first.

Flexible Integration Options

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.

Configurable Rule Exceptions

Allows skipping checks for bindings starting with `_` or lambda patterns to avoid false positives in nixpkgs callPackage, demonstrated with `-L` and `-_` flags.

Cons

Configuration Overhead for Edge Cases

Requires manual flags like `--no-lambda-pattern-names` to handle common nixpkgs patterns, adding setup complexity in projects with complex import structures.

Risk in Automatic Fixes

The `--edit` flag directly modifies source files, and the README warns to commit changes first, indicating potential for unintended data loss if misused.

Limited to Nix Ecosystem

Only scans `.nix` files, lacking support for other languages or IDE plugins, which restricts its utility in mixed-codebase environments.

Frequently Asked Questions

Quick Stats

Stars793
Forks20
Contributors0
Open Issues3
Last commit20 days ago
CreatedSince 2021

Tags

#pre-commit#linter#nix-flake#nix-flakes#cli-tool#code-quality#nixos#nix#rust#static-analysis#dead-code-elimination

Included in

Static Analysis & Code Quality14.5kNix5.0k
Auto-fetched 1 day ago

Related Projects

GitleaksGitleaks

Find secrets with Gitleaks 🔑

Stars30,203
Forks2,307
Last commit23 days ago
GrypeGrype

A vulnerability scanner for container images and filesystems

Stars13,067
Forks924
Last commit1 day ago
Haskell Dockerfile LinterHaskell Dockerfile Linter

Dockerfile linter, validate inline bash, written in Haskell

Stars12,489
Forks510
Last commit4 days ago
clairclair

Vulnerability Static Analysis for Containers

Stars11,080
Forks1,215
Last commit8 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub