Expand description
The gates around the devshell transaction, so the .envrc line is
safe on every directory entry.
Each gate answers one question before anything fetches or spawns:
whether the run is switched off, whether today’s attempt already
happened, whether another shell holds this checkout, and whether the
two files carry uncommitted edits. The lock and the stamp live under
the state root, keyed per checkout — not in the target, where an
untracked file is noise, and not in .git/, which belongs to git.
Structs§
- Lock
- The held single-writer lock; removed on drop.
Enums§
- Acquired
- What acquisition found.
Constants§
- CI_VARS
- The variables a CI runner exports; any of them switches the sync off.
- SWITCH_
VAR - The operator’s own off switch, read from the environment
.envrc.localexports.
Functions§
- acquire
- Take the checkout’s lock, atomically through
O_EXCL. A lock whose owner is provably gone — or, where procfs cannot judge, older than the grace period — is removed and the take retried once. - in_ci
- Whether a CI variable is set to anything but an explicit no.
- switched_
off - Whether the operator switched the sync off with
RK_DEVSHELL_SYNC=0. - today
- Today, as the first ten characters of the UTC clock.
- two_
files_ dirty - Whether
flake.nixorflake.lockcarries uncommitted edits. - write_
stamp - Stamp today’s attempt for one checkout, before the attempt.