refactor(backup): model host backup intent #159
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:electra
host:fleet
host:lyra
host:nova
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!159
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-15-backup-host-facts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/srv/servicesand/srv/stacksas service-state roots while eliminating redundant nested backup paths127.0.0.1:9898Validation
nix fmtnix flake checkjust testdeployment, manual successful backup, and no-opjust testfollow-upd72f5be2verified/srv/services,/srv/stacks, and/mnt/storage/bookstackImplements #15.
Automated code review
Reviewed commit:
95b765ad928c3fa65a01c07a55625d3c060ae3b6Verdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
The diff implements a strict opt-in backup model via
nixosConfig.backup, replacing the legacybackrest.extraPathsapproach across all host and service modules. Privilege escalation to root is intentional, documented in README.md, and mitigated by loopback-only binding (127.0.0.1) and restrictive UMask/StateDirectoryMode settings. All initial advisory points were addressed: path consolidation includes explanatory comments, Btrfs prerequisites are asserted safely withor null, firewall exposure is gated behind non-empty backup intent, and CLI tools/secrets are correctly scoped tolib.mkIf backupEnabled. No actionable defects remain in the provided changes.Blocking findings
None.
Important findings
None.
Suggestions
None.
Tests and validation
Questions
127.0.0.1enforcement in a live environment?backrest/resticCLI tools outside of the automated service, given their conditional installation behindbackupEnabled?Review limitations
nix flake checkresults accurately reflect all host configurations without environment-specific side effects or missing secret files.Diff coverage
README.md: reviewed — included in a context-limited batchhosts/chaos/default.nix: reviewed — included in a context-limited batchhosts/cosmos/default.nix: reviewed — included in a context-limited batchhosts/electra/default.nix: reviewed — included in a context-limited batchhosts/lena/default.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchhosts/vega/default.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/services/backrest.nix: reviewed — included in a context-limited batchmodules/services/bookstack.nix: reviewed — included in a context-limited batchmodules/services/btrbk-home.nix: reviewed — included in a context-limited batchmodules/services/sabnzbd.nix: reviewed — included in a context-limited batchmodules/services/sillytavern.nix: reviewed — included in a context-limited batchReview metadata
Addressed in
85d1dd0(fix(backup): make Backrest intent opt-in).nixosConfig.backupintent now evaluate cleanly and receive no Backrest service, secrets, package, or firewall configuration. All six active hosts remain explicit opt-ins./srv/servicesroot covers Paseo; the enabled BookStack module contributes/mnt/storage/bookstackthroughnixosConfig.backup.dataPaths.nixosConfig.backrest.extraPaths.Validation rerun:
nix fmtandnix flake checkboth pass.Followed up on the two advisory items in
adce2d3(fix(backup): validate backup service prerequisites).nixosConfig.backup.snapshots.homenow asserts that/homeis Btrfs; Electra's generated Disko filesystem configuration satisfies it.Validation rerun:
nix fmtand fullnix flake checkpass.Final robustness follow-up in
c227ed0(fix(backup): reject incomplete firewall intent).nixosConfig.backrest.openFirewall = truenow requires non-empty backup intent, so a port can never be silently requested without an enabled Backrest service./homefilesystem declaration as a clean assertion failure instead of an attribute error.nix flake checkpasses across all active hosts, confirming Electra's snapshot-enabled/homeis explicitly Btrfs and that servicemkAfterpath contributions evaluate correctly.No further code changes are needed from the automated feedback; the remaining gate is the documented live canary before merge.
Live canary follow-up in
95b765a(fix(backup): restrict root Backrest access).The initial Vega run exposed permission-denied reads for application-owned service state, so its snapshot was not valid coverage evidence. Backrest now runs as
rootto read the declared paths, withUMask=0077; its UI is hard-bound to127.0.0.1:9898and 9898 is no longer opened in Vega's firewall. The README documents SSH forwarding for remote administration.Validation:
nix fmt, fullnix flake check, and evaluated Vega unit/firewall checks (User=root,UMask=0077, no 9898 port) all pass.A fresh
just testand successful manual backup with path listing are required before merge.Live canary succeeded after
just test.rootand bound its UI to127.0.0.1:9898.d72f5be2at 2026-08-10 16:10:27 BST, owned byroot@vega./home/nimmo,/mnt/storage/bookstack,/srv/services,/srv/stacks, and/var/lib/SillyTavern.restic lsverified/srv/services(including Paseo and SABnzbd),/srv/stacks, and BookStack content.One no-op
just testfollow-up remains before merge; then the PR can be merged without closing #15 until its operational handoff is complete.No-op deployment follow-up completed on Vega at 16:12 BST.
just testactivated successfully without restarting Backrest;backrest.serviceremained active on the validated root, loopback-only instance (PID 672670). This completes the required genuine deployment plus no-op follow-up evidence.