百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

deadnix

> 编程语言
开源

扫描 Nix 文件以查找死代码

773 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

扫描 Nix 文件以查找死代码

deadnix

Scan .nix files for dead code (unused variable bindings).

Usage with Github Actions

See deadnix-action

Usage with Nix Flakes

Help

…

Reports contain ANSI color escape codes unless the $NO_COLOR environment variable is set.

The --exclude parameter accepts multiple paths. Separate them with -- to pass [FILE_PATHS]....

Scan for unused code

…

Remove unused code automatically

Do commit your changes into version control before!

nix run github:astro/deadnix -- -eq test.nix

Usage with pre-commit

Add the following to your project's .pre-commit-config.yaml:

repos:
  - repo: https://github.com/astro/deadnix
    rev: ID # frozen: VERSION
    hooks:
      - id: deadnix
        #args: [--edit] # Uncomment to automatically modify files
        stages: [commit]

Replace ID and VERSION above with the relevant version tag and commit ID for reference, for example:

rev: da39a3ee5e6b4b0d3255bfef95601890afd80709  # frozen: v1.2.3

Behavior

Renaming of all unused to lambda args to start with _

If you disfavor marking them as unused, use option -l/--no-lambda-arg.

nixpkgs callPackages with multiple imports

callPackages guesses the packages to inject by the names of a packages' lambda attrset pattern names. Some packages alias these with @args to pass them to another import ...nix args.

As the used args are only named in the imported file they will be recognized as dead in the package source file that is imported by callPackage, rendering it unable to guess the dependencies to call the packages with.

Use option -L/--no-lambda-pattern-names in this case.

Skipping reports for certain declarations

As of 1.1.0 deadnix supports the following pragma to skip check of bindings in the following line:

# deadnix: skip

What if the produced reports are wrong?

Please open an issue. Do not forget to include the .nix code that produces incorrect results.

Commercial Support

The author can be hired to implement the features that you wish, or to integrate this tool into your toolchain.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustnixnix-flakenix-langnixos

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言