Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/Kihara777/NixKitsnpx agentmods add skills/kihara777/nixkits/nixos-specialisation-tuningWrote 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/nixos-specialisation-tuning)<a href="https://agentmods.dev/skills/kihara777/nixkits/nixos-specialisation-tuning"><img src="https://agentmods.dev/badge/skills/kihara777/nixkits/nixos-specialisation-tuning/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/nixos-specialisation-tuning"><img src="https://agentmods.dev/badge/skills/kihara777/nixkits/nixos-specialisation-tuning.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.00124 | $0.06644 |
| Opus 5.5 | $0.00050 | $0.02658 |
| Sonnet 5.5 | $0.00025 | $0.01329 |
| Haiku 4.5 | $0.00012 | $0.00664 |
Grade A, and why
nixos-specialisation-tuning 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 2mo 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 — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.
NixOS 分面设计与本地推理调优
用于两类任务:把 NixOS 配置拆成多个启动面,以及在统一内存设备上让本地大模型跑得动、跑得对、跑得快。
适用场景
- 需要"默认精简 + 可选全功能"两套配置,开机菜单选择
- 改动引导器 / 调整默认引导面后系统无法启动
- 分面热切换后服务看似"切成功了"但功能不对(无桌面、D-Bus 服务无法激活)
- 本地 llama.cpp 服务出现输出退化、加载失败、速度异常
- 需要判断某项优化是否值得(要求给出成本/收益/代价,而非单一收益)
分面架构
三文件布局
| 文件 | 职责 | 原则 |
|---|---|---|
spec/<默认面>.nix |
默认配置(如 headless core) | 只 import 必需模块 |
spec/<可选面>.nix |
specialisation.<name>.configuration |
叠加在默认面之上 |
system/base.nix |
两面共用的模式无关底座 | 不含只服务某一面的配置 |
# flake.nix
nixosConfigurations.HOST.modules = [
./spec/core.nix # 默认面
{ specialisation.plasma.configuration = {
imports = [ ./spec/plasma.nix ]; # 可选面
};
}
];
覆盖与冲突
共用模块中的值用 lib.mkDefault 声明,供分面用普通赋值覆盖:
# base/core 中
networking.wireless.iwd.enable = lib.mkDefault true;
# plasma 中覆盖
networking.wireless.iwd.enable = lib.mkForce true;
陷阱:lib.mkForce 覆盖整个属性时,会连带删掉其它模块对该属性的贡献。
⚠️ 实战案例:core 曾用
lib.mkForce覆盖environment.systemPackages,把 base 层提供的bash与systemd一并删除,导致无法登录、systemctl/reboot全部缺失。 规则:systemPackages类列表用追加,不用mkForce覆盖。
面向消费者的归属原则
一个配置项应放在它的消费者所在模块,而非"共用的那个文件"。
⚠️ 实战案例:为给 mihomo 腾出 53 端口而设置的
DNSStubListener=no,起初写进了共用的base.nix。这会让不使用 mihomo 的面也无谓地失去 DNS stub。 判据:若某个面不启用该消费者,它就不该承受这个副作用。
引导菜单与默认面
分面意味着同一个系统有多个可引导入口,故引导器的配置也属于分面设计的一部分。
不要用命令式手段改写引导器生成的文件
规则:引导器配置必须通过其 Nix 选项声明,不得用 sed/cp 等命令式手段在
install 钩子里改写生成物。
⚠️ 实战事故(本机实际发生,导致系统无法启动)
需求:上游 nixpkgs 把 Limine 默认项硬编码为"有 specialisation 就选第 3 项" (
limine-install.py:533),故只要存在可选面,默认就进可选面而非默认面。 为改回默认面,用了extraInstallCommands在 install 之后sed改写limine.conf的default_entry。失败机制——钩子执行在哈希固化之后:
limine-install.py:660 enrollConfig=true → b2sum = blake2b(config_file.strip()) # 对配置内容算哈希 → limine enroll-config <BOOTX64.EFI> <hash> # 固化进 EFI 二进制 limine.nix:471 ${install} "$@" ← 哈希固化在此完成 limine.nix:472 ${cfg.extraInstallCommands} ← sed 在此改写配置改写发生在固化之后 → 哈希不匹配 → Secure Boot 下引导器拒绝加载配置 → 系统无法启动。现场只能靠外部镜像手动关闭 secure boot 与
panicOnChecksumMismatch才进入系统。
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.
- 2mo ago Changed · +137 lines · +27 tokens per session be1122f93801
- 2mo ago Changed · +80 lines · +20 tokens per session 0df40a17078d
- 2mo ago First seen · 249 lines · 77 tokens per session scan A 1c4d658d620f
nixos-specialisation-tuning is a skill published in the GitHub repository Kihara777/NixKits (30 stars, last pushed 4d ago), licensed MIT. It adds 124 tokens to every session and 6,644 once invoked, about $0.0005 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-09-14.
nixos-specialisation-tuning compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| nixos-specialisation-tuningKihara777/NixKits | Skill | 30 | 4d ago | MIT | A | 124 | Claude Code, Codex |
| clawrouterBlockRunAI/ClawRouter | Skill | 6.7k | today | MIT | A | 171 | Claude Code, Codex |
| openai-docsHaohao-end/openagent | Skill | 755 | 7d ago | MIT | A | 74 | Codex |
| ai4j-app-builderLnYo-Cly/ai4j | Skill | 443 | 7d ago | Apache-2.0 | A | 120 | Codex |
| colabLnYo-Cly/ai4j | Skill | 443 | 7d ago | Apache-2.0 | A | 26 | Claude Code, Codex |
| vision-prepznlgis/my-opencode-deepseek-config | Skill | 65 | yesterday | MIT | A | 94 | Claude Code, Codex |
| deepseek-harnessHenryZ838978/deepseek-harness | Skill | 48 | 6d ago | MIT | A | 144 | Claude Code |