Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Lock File Management

flk update backs up flake.lock before changing it, and flk lock lets you inspect and restore those backups.

flk update                              # back up flake.lock, then nix flake update
flk update --show                       # preview updates without applying
flk lock show                           # inputs, revisions, dates
flk lock history                        # backups in .flk/backups/
flk lock restore latest                 # most recent backup
flk lock restore 2025-01-27_14-30-00    # specific timestamp

Backups

flk update and flk lock restore copy the current flake.lock to .flk/backups/ first:

.flk/backups/
├── flake.lock.2025-01-27_14-30-00
├── flake.lock.2025-02-15_09-45-22
└── flake.lock.2025-03-01_16-00-00

Backups are never deleted automatically. Remove old ones from .flk/backups/ by hand.

Updating

flk update runs nix flake update after taking the backup. flk update --show updates the lock file, prints the diff, then puts the original back. If an update breaks something, flk lock restore latest undoes it.

Inspecting and restoring

flk lock show prints each input with its type, source, revision and last-modified date. flk lock history lists the backups. flk lock restore takes latest or a timestamp from that list, and backs up the current flake.lock before replacing it, so a restore can be undone too.

Version pins

Pins from flk add --version live in .flk/pins.nix, not flake.lock, so backups and restores don’t touch them.