Skip to main content

Module txn

Module txn 

Source
Expand description

The fenced two-file transaction behind rk devshell sync.

The tag in flake.nix and the release-kit node in flake.lock move together or not at all. Before the first write both files are copied under the state root and a marker names the target and this process; a build inside the transaction is the fence, so a pin that does not build against the consumer’s own nixpkgs never reaches the tree. Any failure restores both files through the Drop guard, which covers every ?, every early return, and a panic. The crate forbids unsafe, so no signal handler exists: a terminal interrupt during the build leaves the marker, and the next run recovers from it.

Structs§

FinishFailure
A marker that could be neither neutralized nor removed.
RestoreFailure
A restore that could not put a file back; the backups stay.
StepFailure
One failed step: which, and the child’s last stderr line.
Txn
An open transaction: the backups exist and the marker names this process. Dropping it without commit restores both files.

Enums§

AbortFailure
Why an abort did not leave the target clean.
Recovery
What a recovery attempt found.

Functions§

build_devshell
nix build --no-link of the default devshell: the fence. --no-link keeps a directory entry from dropping a result symlink.
current_system
The concrete system attribute this host builds for, from nix itself: guessing it from the compile target would be wrong on the systems that matter.
flake_update
nix flake update release-kit, refreshing the one node.
marker_is_pending
Whether a marker names a run still to recover.
open
Open a transaction over the target’s two files.
recover_pending
Recover a transaction an earlier run left open, where its owner is provably gone.