Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add Kihara777/NixKits --skill nix-packaginggit clone --depth 1 https://github.com/Kihara777/NixKitsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/kihara777/nixkits/nix-packaging)<a href="https://agentmods.dev/skills/kihara777/nixkits/nix-packaging"><img src="https://agentmods.dev/badge/skills/kihara777/nixkits/nix-packaging/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/kihara777/nixkits/nix-packaging"><img src="https://agentmods.dev/badge/skills/kihara777/nixkits/nix-packaging.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00166 | $0.01685 |
| Opus 5.5 | $0.00066 | $0.00674 |
| Sonnet 5.5 | $0.00033 | $0.00337 |
| Haiku 4.5 | $0.00017 | $0.00169 |
Grade A, and why
nix-packaging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.
从零打包
判据:四层验收,缺一层就不算完成
| 层 | 判据 | 什么会骗过你 |
|---|---|---|
| 求值 | nix eval .#packages.<system>.<name>.name 得到预期版本 |
求值过 ≠ 能构建 |
| 构建 | nix build 日志里出现 building '…',不是全缓存 |
缓存命中 = 一行没构建 |
| 产物 | ls $out/bin 与关键文件存在 |
空 bin = 白构建 |
| 运行 | <pkg> --help / --version 退出码 0 |
node 无 wrapper、二进制缺库都在这一层暴露 |
「构建成功」不等于「能用」。 前三层全绿而第四层失败,是这类工作最常见的假通过。
第 1 步:按来源分流
| 来源 | 工具 | 关键点 |
|---|---|---|
| GitHub 源码(C/C++/CMake) | fetchFromGitHub + stdenv.mkDerivation |
布尔 flag 用 lib.cmakeBool,别拼字符串 |
| GitHub 源码(Rust) | rustPlatform.buildRustPackage |
cargoHash 同样两段式 |
| GitHub 源码(npm 前端) | buildNpmPackage |
npmDepsHash + vendored lock(第 3 步) |
| 预编译二进制 | fetchurl + stdenv.mkDerivation |
每架构一个 hash;autoPatchelfHook |
| Python(PyPI) | buildPythonApplication |
format = "pyproject" |
| Gitea / 自托管 forge | fetchFromGitea |
⚠️ /archive/<tag>.tar.gz 返 403;走 API 端点 + stripRoot = true |
| npm registry tarball | fetchurl |
tarball hash 与 npmDepsHash 是两个独立的 hash |
第 2 步:hash 两段式(核心手法)
不要猜 hash,让构建报给你。
- hash 写
lib.fakeHash(字符串,不加括号); - 构建 → 第一处 mismatch 报
got: sha256-…,回填; - 再构建 → 下一处 mismatch(src 之后通常是
npmDepsHash/cargoHash),回填; - 全部回填后必须再构建一次——这次才是验收,不是取 hash。
⚠️ npm 包的特殊陷阱:npmDepsHash 相同不代表依赖没变。新版可能新增依赖而旧 lock
里没有,症状是 ENOTCACHED(request to … failed: cache mode is 'only-if-cached')。
判据是 npm ci 真的过了,不是 hash 对上了。
第 3 步:vendored lock(npm 包)
npm 包 tarball 不带 lock 文件,必须自己 vendor:
- 解出 tarball 的
package.json(tar xzf后取package/package.json); npm install --package-lock-only --ignore-scripts——不要加--legacy-peer-deps:它会丢"peer": true条目,构建报ENOTCACHED;- 生成的
package-lock.json复制进packages/<name>-package-lock.json; - 代码里
lockFile ? ./<name>-package-lock.json,npmDepsHash走两段式。
升级时先看新 lock 的根 "version" 是不是本次版本——同名 store 路径可能装着旧内容。
第 4 步:wrapper 何时需要
- node 包:
buildNpmPackage是否生成可执行$out/bin取决于package.json的bin。 不保证时用makeWrapper包 node,--add-flags <entry>.js,并--prefix PATH : ${lib.makeBinPath [ nodejs ]}。 - 预编译二进制:
autoPatchelfHook+buildInputs(foundation、glibc、libgcc 等)。 - 拿不准就靠第 4 层验收——
--help会直接告诉你缺什么。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 85 lines · 166 tokens per session scan A b5b050f26e42
nix-packaging is a skill published in the GitHub repository Kihara777/NixKits (29 stars, last pushed yesterday), licensed MIT. It adds 166 tokens to every session and 1,685 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-22.
Other skills, from other repositories
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics…
technical-writing
Layered technical-writing standard: Diátaxis structure, Google developer style sentences, STE instruction rules, Global English syntax. Use for /technical-writing or when writing or reviewing docs, RFCs, readmes, PR descriptions, or commit messages.
teach
Explain a body of work plainly so a person actually understands it. Runs the how and why skills and weaves what they find into one clear explanation. Use for 'teach me this', 'help me really understand X', 'explain this change or subsystem to me'.
unslop
Cut AI tells from any writing. Must always apply.
how
Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Can critique architecture. Use why for…
quality-code
Standards for writing or modifying handwritten source code. Use when implementing code changes or reviewing handwritten code. Do not use for browsing, explanation, diagnosis without implementation, generated code, or vendored code.