docs: add BACKUP.md, and stagger the restic schedule per host

The design (layers, password groups, retention, restore steps) was only in
code comments. Also make the timer configurable: a whole hour of random
delay defeated any staggering, and the desktop's push, youko's own run and
btrbk all otherwise contend for the same disks.
This commit is contained in:
Ryan Yin authored and ryan4yin | 二花 committed 2026-09-21 20:38:08 +08:00
1 parent 2ff93c16ce
commit d322f4d2b6
5 files changed
+162 -4

No files matched your search

+2 -1
View File
@@ -28,7 +28,8 @@ modules/
│ └── users.nix # macOS user management
└── nixos/ # NixOS-specific modules
├── base/ # Base NixOS configuration
│ ├── btrbk.nix # Backup configuration
│ ├── btrbk.nix # Local btrfs snapshots
│ ├── restic-backup.nix # Encrypted off-host backups (see ./BACKUP.md)
│ ├── core.nix # Core system settings
│ ├── default.nix
│ ├── i18n.nix # Internationalization
+18 -2
View File
@@ -92,6 +92,23 @@ in
'';
};
onCalendar = lib.mkOption {
type = lib.types.str;
default = "01:30";
description = ''
systemd calendar expression for the backup timer. Give every host its
own slot rather than relying on the random delay: a client's off-host
push, the backup server's own run and btrbk (Tue/Sat 03:45:20 by
default) all contend for the same disks otherwise.
'';
};
randomizedDelaySec = lib.mkOption {
type = lib.types.str;
default = "15m";
description = "Extra random delay on top of {option}`onCalendar`, to smooth load.";
};
pruneOpts = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
@@ -136,8 +153,7 @@ in
++ cfg.exclude;
timerConfig = {
OnCalendar = "01:30";
RandomizedDelaySec = "1h";
inherit (cfg) onCalendar randomizedDelaySec;
};
inherit (cfg) pruneOpts;