登录 注册
其他
1,092
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Haskell
语言
—
创建时间
最近更新

项目能做什么

**nix-tree** 是一个用 Haskell 编写的终端交互工具,解决 Nix 派生包(derivation)依赖关系复杂、体积难以直观分析的问题。它支持终端内按键浏览依赖树,查看自身大小与闭包体积,提供搜索、依赖溯源及导出 DOT 格式等功能。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# nix-tree

[![Build Status](https://github.com/utdemir/nix-tree/actions/workflows/build.yaml/badge.svg)](https://github.com/utdemir/nix-tree/actions/workflows/build.yaml)
[![Packaging status](https://repology.org/badge/vertical-allrepos/haskell:nix-tree.svg?exclude_unsupported=1)](https://repology.org/project/haskell:nix-tree/versions)

Interactively browse dependency graphs of Nix derivations.

[![asciicast](https://asciinema.org/a/cnilbmPXW51g97hdNJZcM5F6h.svg)](https://asciinema.org/a/cnilbmPXW51g97hdNJZcM5F6h)

## Installation

`nix-tree` is on `nixpkgs` since `20.09`, so just use your preferred method for adding packages to your system, eg:

```
nix-env -iA nix-tree
```

Or, for flake enabled systems:

```
nix profile install 'nixpkgs#nix-tree'
```

To run the current development version:

```
nix run github:utdemir/nix-tree -- --help
```

## Usage

```console
$ nix-tree --help
Usage: nix-tree [INSTALLABLE] [--store STORE] [--file FILE] [--version] [--derivation] [--impure] [--dot]

  Interactively browse dependency graphs of Nix derivations.

Available options:
  INSTALLABLE              A store path or a flake reference.
                           Paths default to "~/.nix-profile" and "/var/run/current-system"
  --store STORE            The URL of the Nix store, e.g. "daemon" or "https://cache.nixos.org"
                           See "nix help-stores" for supported store types and settings.
  --file FILE              Interpret installables as attribute paths relative to the Nix expression stored in file.
  --version                Show the nix-tree version
  --derivation             Operate on the store derivation rather than its outputs
  --impure                 Allow access to mutable paths and repositories
  --dot                    Print the dependency graph in dot format
  -h,--help                Show this help text

Keybindings:
  hjkl/Arrow Keys : Navigate
  w               : Open why-depends modal
  /               : Open search modal
  s               : Change sort order
  y               : Yank selected path to clipboard
  ?               : Show help
  q/Esc           : Quit / close modal
```

### Glossary

* **NAR Size**: Size of the store path itself.
* **Closure size**: Total size of the store path and all its transitive dependencies.
* **Added size**:  Size of the store path, and all its _unique_ transitive
  dependencies. In other words, the cost of having that store path on top
  of all other paths. See [issue #14] for a better explanation.

[issue #14]: https://github.com/utdemir/nix-tree/issues/14

### Tips

`nix-build` prints built paths to stdout, which can be piped conveniently
with `| xargs -o nix-tree`. Examples:

```bash
# Output of a local derivation
nix-build . --no-out-link | xargs -o nix-tree

# Build time dependencies (passing a `.drv` path)
nix-instantiate . | xargs -o nix-tree --derivation

# Dependencies from shell.nix
nix-build shell.nix -A inputDerivation | xargs -o nix-tree

# All outputs of a derivat
阅读完整原文

项目深度分析 AI 生成

CI/CD Nix 依赖门禁与体积回归检测 SaaS (GitHub Action / CLI)

产品构想基于 nix-tree 的 closure/added size 算法,开发无头(Headless)CI 工具,在 PR 触发时对比基线分支,分析新增依赖和闭包体积增量,提供交互式 Web 报表并支持超限阻断。
核心功能PR 差异对比(Closure diff);体积膨胀原因自动归因;阈值告警与阻断;Web 端交互式依赖图下钻;历史体积趋势看板。
目标用户使用 Nix 构建容器镜像或分发二进制的企业研发团队、SRE/DevOps 团队。
难度/周期中等 · 1 - 2 个月 · 成本:极低(主要是 CI 运行节点及报表托管服务,约 $30-$100/月)
收费模式免费版支持开源项目,商业团队按席位或每月 CI 分析运行次数订阅($29-$199/月)。
竞争风险Nix 商业用户基数相比传统 Docker 生态较小;部分团队可能倾向于自行编写简易 shell 脚本通过 `nix path-info` 解决基础需求。
依据 已验证事实(nix-tree 已实现 NAR Size、Closure size、Added size 核心算法及 why-depends 逻辑)与 AI推测(企业 CI 存在防止镜像体积膨胀的通用刚需)结合。

NixOS / Nix 基础设施体积瘦身与成本优化咨询服务

产品构想结合 nix-tree 提供的依赖溯源和体积归因能力,提供面向企业的专项服务,帮助企业清理 Nix 二进制缓存(Cachix/S3)中的冗余数据,优化容器镜像体积与构建开销。
核心功能基础镜像/闭包依赖全面审计报告;依赖裁剪与 override 定制方案;私有 Cache 垃圾回收与留存策略优化实施。
目标用户深度使用 Nix 构建系统且云存储/带宽账单较高的科技初创企业或技术团队。
难度/周期低 · 即时开展(1-2 周内完成单个项目交付) · 成本:接近 0(个人时间成本)
收费模式按项目计费或按节省成本的一定比例抽成(如单次审计与方案交付 $1,000 - $5,000)。
竞争风险项目交付难以规模化标准化;高度依赖客情关系与 Nix 专业技能壁垒。
依据 数据支持的判断(依赖规模直接挂钩云传输和存储成本)及 AI推测。

Nix 软件供应链安全与许可(License)合规分析扩展

产品构想将 nix-tree 的依赖遍历能力扩展至软件成分分析(SCA),解析每个 store path 的 License、CVE 漏洞及闭源组件,生成企业合规所需的 SBOM(如 SPDX/CycloneDX)报告及可视化导航。
核心功能交互式 TUI/Web 许可证树状查看器;CVE 自动关联与标记;一键导出标准 SBOM 文件;高风险依赖链为什么被引入的路径追踪(why-depends)。
目标用户有出海合规要求、企业合规审查或 SOC2/FedRAMP 认证需求的 Nix 生态企业。
难度/周期高 · 3 - 4 个月 · 成本:低(依赖 CVE 数据库同步,轻量云服务器约 $50/月)
收费模式企业授权许可证(On-premise CLI 授权)或按月企业安全合规订阅($99+/月)。
竞争风险Haskell 维护门槛较高;生态内已有通用 SBOM 工具竞争(虽然对 Nix 的深度适配较少)。
依据 尚需验证的假设(企业对 Nix 原生 SBOM 和安全依赖链追踪存在明确的独立买单意愿)。
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建时间待补全,最近推送
社区活跃Star 1,092 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。