About nix-rebuild
nix-rebuild is a skill for applying changes to Nix-managed configuration on macOS. It documents a direct darwin-rebuild command and the hey wrapper for rebuilding, testing, and rolling back system generations.
Key features
- 01Rebuild configuration with darwin-rebuild
- 02Run rebuilds through hey
- 03Build and activate without a boot entry
- 04Roll back to the previous generation
- 05Verify updated Nix store symlinks
Use cases
- 01Apply edits to Nix configuration files
- 02Activate changes to Home Manager-linked files
- 03Recover from an unwanted system generation
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ edmundmiller/ dotfiles --skill nix-rebuildAfter installing, type/nix-rebuildin Claude Code to confirm it loaded.
Details
From the project READMENix System Rebuild
After changing any Nix-managed config in ~/.config/dotfiles, the system must be rebuilt for changes to take effect. Nix store symlinks are read-only — you cannot edit them in place.
Quick Rebuild
cd ~/.config/dotfiles
sudo darwin-rebuild switch --flake .
darwin-rebuild has a NOPASSWD sudoers rule, so this works non-interactively.
Using hey
The hey command wraps rebuilds:
hey rebuild # or: hey re
hey test # build + activate without boot entry
hey rollback # roll back to previous generation
When to Rebuild
- After editing any
.nixfile - After editing config files symlinked through home-manager (lazygit, ghostty, etc.)
- When you see "permission denied" writing to a Nix store path
Workflow
- Edit source config in
~/.config/dotfiles/ - Commit changes
- Run
sudo darwin-rebuild switch --flake ~/.config/dotfiles - Verify the symlink now points to updated Nix store path
Comments
Markdown supported