Files
JakeHillion bf7e290807
commit-validation / validate-single-commit (pull_request) Successful in 8s
buildbot/nix-eval Build done. (652 warnings)
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
impermanence: recreate /cache as an empty subvolume on every boot
Move the /cache reset from boron into the impermanence module so any
host can enable it with custom.impermanence.cache.enable and name the
btrfs device holding it with custom.impermanence.cache.device.

A reset-cache unit recreates the cache subvolume, directly under the
btrfs top level, as an empty subvolume with mode 1777 whenever /cache
is about to be mounted and is not mounted already. It runs in the
initrd on every boot, deleting the old subvolume and any nested
subvolumes, and in the running system when the cache is enabled by a
live switch, where it also recreates the directories activation has
already made for cache.extraDirs. It never touches a mounted cache,
the mount only wants it, and switches never restart it, so a live
switch with the cache already enabled leaves /cache alone. Disabling
the cache live unmounts it.

/cache is mounted in the initrd (neededForBoot). It and the directories
persisted on it are nofail, ordered before the filesystem targets, so a
cache that cannot be prepared leaves them in RAM rather than failing
local-fs.target.

The hardware models for maverick and iceman set cache.device alongside
their disk layout.

Enable the cache on maverick and iceman. On boron, replace the
host-specific reset unit and /cache mount with the module, keep Nix
builds in /cache/nix-builds, and stop using the old empty_snapshot,
system and nix-builds subvolumes; the first boot deletes them along
with the old cache subvolume.

Test plan:
- NixOS VM test, not included, on a two-disk btrfs RAID1: live
  enable with and without an existing subvolume, live disable, live
  switch and restart of reset-cache with the cache mounted, live
  switch and cold boot from the previous boron-style mount, cold boots
  wiping nested subvolumes, and live switch and cold boot with a
  missing device
- nix build boron, maverick and iceman toplevels
- impermanence module tests
- CI
2026-11-07 17:33:00 +00:00
..