Module linux

Module linux 

Source
Expand description

Linux (NixOS) activation primitives. fire_* uses systemd-run --unit=... so the agent’s SIGTERM can’t kill the activation mid-run.

Structs§

LinuxBackend

Constants§

CURRENT_SYSTEM_PATH 🔒
SWITCH_INHIBITORS 🔒
Critical components whose live-swap nixos-rebuild refuses. Detection is canonicalize-equality on the symlink target between current + new closure. init is NOT listed: it’s a regenerated-per-system stub that always differs across closures regardless of whether anything runtime-relevant changed; listing it would force a defer on every update. The actually- unsafe components are systemd (PID 1), kernel, and dbus.
SWITCH_LOCK_PATH 🔒

Functions§

detect_switch_inhibitors 🔒
Returns Some(component) when a critical-component swap is detected between the running system and the new closure. Either side missing the path is out-of-scope (returns None for that component) - we only flag genuine swaps, not absences.
fire_rollback 🔒
LOADBEARING: target_basename resolves to the rolled-back closure’s store path, NOT /run/current-system. The agent fires rollback while the failed closure is still current, so its switch-to-configuration would “switch to” itself - a no-op that leaves nginx (or whatever caused the failure) still down. Use the freshly-flipped profile target’s binary.
fire_switch 🔒
is_switch_in_progress 🔒
Fail-open: absent lock file or missing flock binary -> false.
is_switch_in_progress_at 🔒
read_unit_exit_code 🔒
None on failure / empty / non-numeric (never synthesise a misleading 0).
rollback_switch_bin 🔒