| name | flake-update |
| description | Update flake.lock, handle patches, and test builds. Use when asked to update the flake, run nix run .#update, handle patch failures, or test darwin/nixos builds after an update. |
| type | Skill |
| timestamp | "2026-07-03T20:19:14.000Z" |
Full reference: docs/flake-update.md
Fork workflow: docs/flake-update.fork.md (if fork remote configured)
Patch handling: docs/flake-patches.md
Quick summary (no fork)
nix run '.#update'
jj describe -m 'chore(flake): update'
jj bookmark set upstream -r @-
Patch failures
- Search nixpkgs for a fix:
gh search prs "<package>" --repo NixOS/nixpkgs --limit 5
- Check if fix is in nixos-unstable:
gh api "repos/NixOS/nixpkgs/compare/nixos-unstable...<commit>" --jq '.status'
"ahead" = not yet landed → register patch
"behind" / "identical" = already landed → remove old patch
- Add to
.flake.patches/config.toml:
[patch.nixpkgs.my-fix]
url = "https://github.com/NixOS/nixpkgs/pull/<PR>.patch?full_index=1"
- Re-run:
nix run '.#update' -- g:patches
Testing
PRE_UPDATE_REV=$(jj log -r 'upstream@<fork-remote>' --no-graph -T 'commit_id')
nix run "git+file://$PWD?rev=${PRE_UPDATE_REV}#darwin-rebuild" -- build
nix run '.#darwin-rebuild' -- build
nix run '.#darwin-rebuild' -- switch
./nixos-rebuild.sh build
./nixos-rebuild.sh switch
./nixos-rebuild.sh build remote=<hostname>
./nixos-rebuild.sh switch remote=<hostname>
Agent notes
jj bookmark set upstream -r @- — targets the just-described commit, not the new empty @
- Run
nix run '.#darwin-rebuild' -- build in background: pass run_in_background=true
- Never run
switch — hand off to user (requires sudo)