Use when working with NixOS configurations, Home Manager setups, Nix flakes, services, or troubleshooting Nix builds. Covers creating new configurations, modifying existing ones, adding packages, setting up services, writing modules, and debugging build failures.
npx claudepluginhub ohare93/claude-setup --plugin jmo-development-toolsThis skill uses the workspace's default tool permissions.
**Announce at start**: "I'm using the nixos-config skill to work with your Nix configuration."
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Announce at start: "I'm using the nixos-config skill to work with your Nix configuration."
nix-envjj new so they appear in git HEADresult symlinks created during builds| Task | Command |
|---|---|
| Rebuild NixOS (test) | sudo nixos-rebuild test --flake .#<hostname> |
| Rebuild NixOS (switch) | sudo nixos-rebuild switch --flake .#<hostname> |
| Home Manager build | home-manager build --flake .#user@hostname --no-out-link |
| Home Manager switch | home-manager switch --flake .#user@hostname |
| Check flake | nix flake check |
| Evaluate expression | nix-instantiate --eval -E '<expr>' |
| Interactive REPL | nix repl |
| Show derivation | nix show-derivation |
| Update single input | nix flake update <input> |
| Update all inputs | nix flake update |
Before making changes, understand the current setup:
flake.nix to understand inputs, outputs, and structuremynix)Determine scope and approach:
Write the configuration following Nix best practices:
lib.mkEnableOption for boolean toggleslib.mkOption with proper types (types.str, types.listOf, types.attrsOf, etc.)lib.mkIf for conditional configurationlib.mkDefault for defaults that users can overridelib.mkForce sparingly and only when necessarylib.mkMerge to combine multiple config blockslib.assertMsg for meaningful error messages on invalid configjj new so they are trackedsudo nixos-rebuild test --flake .#<hostname>home-manager build --flake .#user@hostname --no-out-linknix flake check if structural changes were made to the flakeresult symlinks: rm -f resultjj squashIf the build fails, follow this process:
nix-instantiate --eval to test expressions in isolationnix repl to interactively explore valuesnix show-derivation to inspect build dependencies| Error | Cause | Fix |
|---|---|---|
error: getting status of '/nix/store/.../<file>' | New file not tracked by git | Run jj new to snapshot, then rebuild |
error: attribute 'X' missing | Typo in option name or missing import | Check spelling, verify module is imported in flake.nix |
error: infinite recursion encountered | Circular dependency between options | Break the cycle with lib.mkMerge or restructure |
error: value is a X while a Y was expected | Wrong option type | Check mkOption type declaration matches usage |
error: option 'X' does not exist | Module not imported or option path wrong | Verify import chain and option path |
collision between '/nix/store/...' | Two packages provide same file | Use lib.mkForce or packageOverrides to resolve |
error: flake 'X' does not provide attribute | Wrong output path in flake | Check nixosConfigurations / homeConfigurations names |
This is the most common issue. New files are not visible to the Nix evaluator until they are tracked:
jj new # snapshot new files into git HEAD
# then rebuild
Remember to squash related changes afterward if needed.
Reference materials are available in the references/ directory:
nix-language.md — Nix language syntax and builtinsflake-patterns.md — Flake structure, inputs, and overlaysnixos-modules.md — Module structure, option declarations, and config patternshome-manager.md — Home Manager modules, programs, and servicestroubleshooting.md — Error catalog, debugging workflow, and migration patterns