nix-darwin

nix-darwin is a skill for Claude Code, Codex from ahonn/dotfiles. It costs 67 tokens per session (1,116 once invoked), scanned B, original, MIT.

A guide for organizing macOS configuration with nix-darwin, Home Manager, and Homebrew. It separates system settings, user settings, and graphical applications into layers.

In plain words
What is it for?
Use it to add or enable programs, manage workstation and homelab configurations, and organize Nix-based macOS settings.
Why use it?
It gives a consistent structure for maintaining a Mac setup across different machines. It helps keep host-specific changes from being mixed into shared configuration.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ahonn/dotfiles/nix-darwin
Any agent
npx skills add ahonn/dotfiles --skill nix-darwin
Clone the repo
git clone --depth 1 https://github.com/ahonn/dotfiles

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-darwin

README.md
[![agentmods](https://agentmods.dev/badge/skills/ahonn/dotfiles/nix-darwin.svg)](https://agentmods.dev/skills/ahonn/dotfiles/nix-darwin)
Your own site
<a href="https://agentmods.dev/skills/ahonn/dotfiles/nix-darwin"><img src="https://agentmods.dev/badge/skills/ahonn/dotfiles/nix-darwin.svg" alt="Measured on agentmods" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,116 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
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 $0.00067 $0.01116
Opus 5 $0.00034 $0.00558
Sonnet 5 $0.00013 $0.00223
Haiku 4.5 $0.00007 $0.00112

Measured yesterday against content hash a42e5b11c955, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

nix-darwin scanned grade B with 1 finding 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 yesterday.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .#workstation
.claude/skills/nix-darwin/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

nix-darwin Configuration

Architecture

Three-layer system: darwin modules (system) → home-manager (user) → homebrew (GUI apps).

flake.nix                          # Thin orchestration layer
├── hosts/workstation/             # Unstable packages, full toolchain
│   ├── default.nix → modules/darwin/
│   ├── home.nix    → modules/home-manager/base.nix + program modules
│   └── homebrew.nix → modules/homebrew/base.nix + host casks
└── hosts/homelab/                 # Stable packages (macOS 13), minimal
    ├── default.nix → modules/darwin/
    ├── darwin.nix                  # Host-specific overrides (mkForce)
    ├── home.nix    → modules/home-manager/base.nix + neovim-stable
    └── homebrew.nix

For full dependency flow and module layers, see references/architecture.md.

Core Conventions

Program Toggle Pattern

Every program module follows this structure (see templates/program-module.nix):

options.my.{program}.enable = mkEnableOption "description";
config = mkIf cfg.enable { /* config */ };

Enable in host's home.nix:

my.neovim.enable = true;

Adding a New Program

  1. Create modules/home-manager/programs/{name}.nix using template
  2. Import it in the host's home.nix
  3. Set my.{name}.enable = true
  4. If it needs a GUI cask, add to hosts/{host}/homebrew.nix

Configuration Management

Method When to Use Example
mkOutOfStoreSymlink Config that changes without rebuild nvim, aerospace
builtins.readFile Config loaded into nix store zed-editor
Inline nix Simple, nix-native config ghostty, starship

Naming Conventions

  • Nix files: kebab-case.nix
  • Module options: my.{program}.enable
  • Dotfile symlinks: {name}.symlink in symlink/
  • Hosts: kebab-case
  • Commits: conventional (feat(neovim):, fix(darwin):)

Essential Commands

See references/commands.md for full list.

# Apply configuration
sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .#workstation
sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .#homelab

# Validate without applying
nix flake check

# Update inputs
nix flake update

Read the full file on GitHub · 116 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 116 lines · 67 tokens per session scan B a42e5b11c955

Subscribe to this mod's changes

nix-darwin is a skill published in the GitHub repository ahonn/dotfiles (62 stars, last pushed 5d ago), licensed MIT. It adds 67 tokens to every session and 1,116 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

coding

Principles for writing and designing code, covering API and abstraction design, naming, comment discipline, and standards of evidence for claims about code behavior. Use whenever the task is to write or modify code, design an API or software architecture, or review code.

ryota2357/dotfiles · 53 tokens

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

magic3007/dotfiles · 50 tokens

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

magic3007/dotfiles · 56 tokens

esm

Comprehensive toolkit for EvolutionaryScale protein language models including ESM3 (generative multimodal design across sequence, structure, and function) and ESM C (efficient embeddings). Use for protein sequence/structure/function tasks, inverse folding, embeddings, variant design, and ESMFold2 structure prediction…

magic3007/dotfiles · 96 tokens

ralph-loop

Ralph Wiggum 迭代开发循环。三阶段工作流(需求→规划→构建),每阶段有 code review + 测试 gate。 触发词:ralph loop、迭代开发、interview me、plan system、build system。.

magic3007/dotfiles · 63 tokens

mcp-notion-usage-guide

MCP Notion工具使用指南,包含常见问题解决方案和最佳实践。使用当: (1) 访问Notion数据库view URL出现"URL type view not currently supported"错误, (2) 需要获取数据库schema和表结构信息, (3) 查询数据库中的条目内容, (4) 创建页面时MULTISELECT字段值不存在导致失败, (5) 需要更新数据库schema添加新选项, (6) 开发需要集成Notion数据的自动化工作流, (7) querydatasources/query-database-view返回Business Plan要求错误, (8) 需要在无Business…

magic3007/dotfiles · 152 tokens