nix-packaging

nix-packaging is a skill for Claude Code, Codex from Kihara777/NixKits. It costs 166 tokens per session (1,685 once invoked), scanned A, original, MIT.

A step-by-step guide for packaging software as Nix expressions, including source fetching, dependency hashes, building, checking outputs, and running the result. Nix is a system for reproducible software packages and environments.

In plain words
What is it for?
Use it to create a new Nix package from source, an npm package, a Rust project, Python software, a prebuilt binary, or a Gitea repository.
Why use it?
It avoids declaring a package finished when it only evaluates or builds but cannot actually run.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for codewhale. Also seen: built for codewhale.

Good fit Use it to create a new Nix package from source, an npm package, a Rust project, Python software, a prebuilt binary, or a Gitea repository.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kihara777/nixkits/nix-packaging
Install

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.

Any agent
npx skills add Kihara777/NixKits --skill nix-packaging
Clone the repo
git clone --depth 1 https://github.com/Kihara777/NixKits

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for nix-packaging

README.md
[![agentmods](https://agentmods.dev/badge/skills/kihara777/nixkits/nix-packaging/github.svg)](https://agentmods.dev/skills/kihara777/nixkits/nix-packaging)
Your own site
<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.

agentmods 80×15 button for nix-packaging

Your own site · 80×15
<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>
Per session 166 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,685 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 2d ago against content hash b5b050f26e42, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

skills/nix-packaging/SKILL.md · 85 lines

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,让构建报给你。

  1. hash 写 lib.fakeHash(字符串,不加括号);
  2. 构建 → 第一处 mismatch 报 got: sha256-…,回填;
  3. 再构建 → 下一处 mismatch(src 之后通常是 npmDepsHash / cargoHash),回填;
  4. 全部回填后必须再构建一次——这次才是验收,不是取 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:

  1. 解出 tarball 的 package.json(tar xzf 后取 package/package.json);
  2. npm install --package-lock-only --ignore-scripts ——不要加 --legacy-peer-deps:它会丢 "peer": true 条目,构建报 ENOTCACHED;
  3. 生成的 package-lock.json 复制进 packages/<name>-package-lock.json;
  4. 代码里 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 会直接告诉你缺什么。

Read the full file on GitHub · 85 lines

Changes

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.

  1. 2d ago First seen · 85 lines · 166 tokens per session scan A b5b050f26e42

Subscribe to this mod's changes

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.

Related

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…

alyraffauf/hoenn · 89 tokens

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.

alyraffauf/hoenn · 52 tokens

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'.

alyraffauf/hoenn · 60 tokens

unslop

Cut AI tells from any writing. Must always apply.

alyraffauf/hoenn · 14 tokens

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…

alyraffauf/hoenn · 64 tokens

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.

alyraffauf/hoenn · 43 tokens