refactor(youko): create the /data-ro mountpoints in initrd tmpfiles

Root is tmpfs, so the backing dirs must exist before the /data bind
mounts. initrd tmpfiles rules on /sysroot do that before switch-root,
replacing the activation script.

Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
Ryan Yin authored and ryan4yin | 二花 committed 2026-11-01 11:42:57 -06:00
1 parent 6fa6e6626e
commit 64c465660c
1 file changed
+7 -7
@@ -23,13 +23,13 @@ in
];
};
# Pre-create the backing directory and subvolume mountpoints on the root
# filesystem. activation runs before sysinit.target (before all mount
# units), and writes to /data-ro (not the ro-mounted /data), so this is
# safe to re-run on nixos-rebuild switch.
system.activationScripts.data-ro-backing.text = ''
mkdir -p /data-ro/fileshare /data-ro/apps /data-ro/backups /data-ro/apps-snapshots
'';
# Root is tmpfs: create the backing dir and subvolume mountpoints before switch-root.
boot.initrd.systemd.tmpfiles.settings.data-ro = {
"/sysroot/data-ro/apps".d = { };
"/sysroot/data-ro/apps-snapshots".d = { };
"/sysroot/data-ro/backups".d = { };
"/sysroot/data-ro/fileshare".d = { };
};
fileSystems."/data/fileshare/public".depends = [ "/data/fileshare" ];