fix(viridian): resolve backup system initialization issues

Fix snapper and borgbackup jobs to work with ephemeral-btrfs setup:

Snapper fixes:
- Remove global /.snapshots mount (use nested subvolumes instead)
- Remove unused hostname variable
- Snapshots now stored in .snapshots subvolumes within each service

Borgbackup fixes:
- Add systemd.tmpfiles.rules to create staging directories at boot
- Add readWritePaths for staging directories (systemd sandboxing)
- Staging directories survive ephemeral root wipes

Architecture notes:
- Nested .snapshots subvolumes don't require separate mounts
- systemd tmpfiles ensures directories exist before services start
- ProtectSystem=strict requires explicit ReadWritePaths allowlist
This commit is contained in:
♥ Minnie ♥ 2025-10-07 09:38:07 +08:00
parent c05598d9e0
commit 7833d89d86
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
3 changed files with 18 additions and 13 deletions

View file

@ -8,7 +8,15 @@
rekeyFile = ./passphrase.age;
};
# Create staging directory before borg service starts
systemd.tmpfiles.rules = [
"d /.staging-offsite 0755 root root -"
];
services.borgbackup.jobs."offsite" = {
# Allow writing to staging directory
readWritePaths = [ "/.staging-offsite" ];
# Create staging snapshots before backup (independent from onsite)
preHook = ''
# Create read-only staging snapshots for each service

View file

@ -15,7 +15,15 @@ in {
];
};
# Create staging directory before borg service starts
systemd.tmpfiles.rules = [
"d /.staging-onsite 0755 root root -"
];
services.borgbackup.jobs."onsite" = {
# Allow writing to staging directory
readWritePaths = [ "/.staging-onsite" ];
# Create staging snapshots before backup (independent from offsite)
preHook = ''
# Create read-only staging snapshots for each service