nix-darwin-home-manager

Edit a nix-darwin and home-manager flake to declaratively manage macOS packages, defaults, and secrets.

1|Updated Jan 27, 2025
One-click install
npx skills add https://github.com/KasimKaizer/nix-darwin-config --skill nix-darwin-home-manager-kasimkaizer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nix-darwin-home-manager
Source: https://github.com/KasimKaizer/nix-darwin-config/tree/main/modules/home/agents/skills/nix-darwin-home-manager
Command: npx skills add https://github.com/KasimKaizer/nix-darwin-config --skill nix-darwin-home-manager-kasimkaizer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Managing a macOS machine declaratively with nix-darwin, home-manager, nix-homebrew, and sops-nix requires knowing exactly which module owns each concern; this Skill routes every change (packages, casks, defaults, secrets, skills) to the correct file in this specific flake so edits survive the next nixswitch. ## Core Features & Use Cases - Change classification: Maps each request (GUI app, CLI, masApps, macOS defaults, Dock icons, skhd hotkeys, fonts, zsh aliases, editor settings) to the exact module file that owns it. - Secrets workflow: Guides sops-nix patterns for secret env vars, secret files, and rendered configs using the private inputs.nix-secrets vault with age keys. - Agent Skill management: Creates or modifies custom Agent Skills under modules/home/agents/skills/ and allowlists third-party skills in skills.nix. - Use Case: When asked to "install Rectangle", the Skill adds it to modules/darwin/homebrew.nix casks instead of running brew install, then tells the user to run nixswitch. ## Quick Start Ask the agent to add a package, cask, secret, or macOS default to this nix-darwin flake and follow its instruction to run nixswitch.

Frequently Asked Questions about nix-darwin-home-manager

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a CLI package to a nix-darwin home-manager flake?▼

Search the flake with rg first to avoid duplicating an existing cask, then append the nixpkgs attribute to the home.packages list in the owning module, typically modules/home/default.nix. Run nix fmt and tell the user to run nixswitch.

How do I install a GUI macOS app declaratively with nix-darwin?▼

GUI apps go in the casks list of modules/darwin/homebrew.nix, and App Store apps go in masApps with ids found via mas search. Never run brew install, because cleanup = "zap" removes undeclared Homebrew packages on the next switch.

How do I add a secret environment variable with sops-nix?▼

Add the key in the private vault with sops secrets.yaml, declare sops.secrets.<name> in tools/secrets.nix, and export it through the sops.templates secret-env file using config.sops.placeholder. Then run nix flake update nix-secrets && nixswitch && exec zsh.

Should I use home.packages or Homebrew casks for macOS apps?▼

GUI apps with a .app bundle belong in Homebrew casks, while CLI tools available in nixpkgs belong in home.packages. Some CLIs are already shipped as casks in this flake, so search first to avoid duplicates.

Why did my nix-darwin activation fail with an hm-bak error?▼

A stale *.hm-bak backup file next to a managed file blocks activation because backupFileExtension is set to hm-bak. Delete the leftover backup file and retry the switch.

Can I use defaults write or brew install alongside this flake?▼

No. defaults.nix reasserts managed macOS defaults on every switch, and Homebrew cleanup = "zap" removes undeclared packages. Declare changes in the appropriate module instead so they persist.