aboutsummaryrefslogtreecommitdiff
path: root/tw/system/vin.scm
diff options
context:
space:
mode:
authorTimo Wilken2024-02-16 20:32:54 +0100
committerTimo Wilken2024-02-16 20:32:54 +0100
commita4b1959d4d8db46abeb2cdddbf85b6b502546aed (patch)
tree2a1420b5f2ae9cd8660b0b338d2dba15f9b698e4 /tw/system/vin.scm
parentb2e40e5e0d7b02c62764a53b8e52f2c98c5379b1 (diff)
Clean up backups from new machines
Diffstat (limited to 'tw/system/vin.scm')
-rw-r--r--tw/system/vin.scm129
1 files changed, 64 insertions, 65 deletions
diff --git a/tw/system/vin.scm b/tw/system/vin.scm
index dc5bc756..6a72026d 100644
--- a/tw/system/vin.scm
+++ b/tw/system/vin.scm
@@ -69,76 +69,75 @@
(prometheus-auth? #f)))
(service restic-cleanup-service-type
- (list (restic-scheduled-cleanup
- ;; Laptop backups run at "0 */2 * * *".
- (schedule #~"0 5 * * *")
- (repo (restic-local-repository
- (path "/var/backups/restic/timo/laptop")))
- (password (restic-password-source
- (type 'file)
- (name "/etc/restic/timo-laptop")))
- (user "restic")
- (keep-within "14d")
- (keep-weekly 52)
- (keep-monthly -1))
+ (cons*
+ ;; Phone backups run with a new version of restic, which creates
+ ;; v2 repos by default. Guix' older restic version can't read
+ ;; these, so create the repo on the server before pushing to it.
+ ;; Restic doesn't automatically upgrade the repo version.
+ ;;
+ ;; Phone backups run "daily" (modulo Android's throttling of
+ ;; the Restic app; usually between midnight and 2am), so use
+ ;; `keep-daily' instead of `keep-within' to discard duplicates.
- (restic-scheduled-cleanup
- (schedule #~"0 5 * * *")
- (repo (restic-local-repository
- (path "/var/backups/restic/timo/sync")))
- (password (restic-password-source
- (type 'file)
- (name "/etc/restic/timo-sync")))
- (user "restic")
- (keep-within "14d")
- (keep-weekly 52)
- (keep-monthly -1))
+ (restic-scheduled-cleanup
+ (schedule #~"0 4 * * *")
+ (repo (restic-local-repository
+ (path "/var/backups/restic/timo/phone")))
+ (password (restic-password-source
+ (type 'file)
+ (name "/etc/restic/timo-phone")))
+ (user "restic")
+ (snapshot-paths '("/storage/FF37-F8E6/SignalBackup"))
+ ;; We only really care about the last signal backup, but guard
+ ;; against accidental deletion by keeping more.
+ (keep-daily 3))
- ;; Phone backups run with a new version of restic, which creates
- ;; v2 repos by default. Guix' older restic version can't read
- ;; these, so create the repo on the server before pushing to it.
- ;; Restic doesn't automatically upgrade the repo version.
- ;;
- ;; Phone backups run "daily" (modulo Android's throttling of
- ;; the Restic app; usually between midnight and 2am), so use
- ;; `keep-daily' instead of `keep-within' to discard duplicates.
+ (restic-scheduled-cleanup
+ (schedule #~"0 4 * * *")
+ (repo (restic-local-repository
+ (path "/var/backups/restic/timo/phone")))
+ (password (restic-password-source
+ (type 'file)
+ (name "/etc/restic/timo-phone")))
+ (user "restic")
+ (snapshot-paths '("/storage/emulated/0/Backups"))
+ (keep-daily 14)
+ (keep-monthly -1))
- (restic-scheduled-cleanup
- (schedule #~"0 4 * * *")
- (repo (restic-local-repository
- (path "/var/backups/restic/timo/phone")))
- (password (restic-password-source
- (type 'file)
- (name "/etc/restic/timo-phone")))
- (user "restic")
- (snapshot-paths '("/storage/FF37-F8E6/SignalBackup"))
- ;; We only really care about the last signal backup, but guard
- ;; against accidental deletion by keeping more.
- (keep-daily 3))
+ (restic-scheduled-cleanup
+ (schedule #~"0 4 * * *")
+ (repo (restic-local-repository
+ (path "/var/backups/restic/timo/phone")))
+ (password (restic-password-source
+ (type 'file)
+ (name "/etc/restic/timo-phone")))
+ (user "restic")
+ (snapshot-paths '("/storage/FF37-F8E6/OAndBackupX"))
+ (keep-daily 14)
+ (keep-monthly -1))
- (restic-scheduled-cleanup
- (schedule #~"0 4 * * *")
- (repo (restic-local-repository
- (path "/var/backups/restic/timo/phone")))
- (password (restic-password-source
- (type 'file)
- (name "/etc/restic/timo-phone")))
- (user "restic")
- (snapshot-paths '("/storage/emulated/0/Backups"))
- (keep-daily 14)
- (keep-monthly -1))
+ ;; Computer backups run at "0 */2 * * *".
+ ;; Backups of sync folders run at "X */2 * * *" on computers,
+ ;; for various values of X (to avoid conflicts), and nightly
+ ;; around midnight on the phone.
+ (map (lambda (repo)
+ (let ((path (car repo))
+ (password-file (cdr repo)))
+ (restic-scheduled-cleanup
+ (schedule #~"0 5 * * *")
+ (repo (restic-local-repository (path path)))
+ (password (restic-password-source
+ (type 'file)
+ (name password-file)))
+ (user "restic")
+ (keep-within "14d")
+ (keep-weekly 52)
+ (keep-monthly -1))))
- (restic-scheduled-cleanup
- (schedule #~"0 4 * * *")
- (repo (restic-local-repository
- (path "/var/backups/restic/timo/phone")))
- (password (restic-password-source
- (type 'file)
- (name "/etc/restic/timo-phone")))
- (user "restic")
- (snapshot-paths '("/storage/FF37-F8E6/OAndBackupX"))
- (keep-daily 14)
- (keep-monthly -1))))
+ '(("/var/backups/restic/timo/laptop" . "/etc/restic/timo-laptop")
+ ("/var/backups/restic/timo/framework" . "/etc/restic/timo-framework")
+ ("/var/backups/restic/timo/battleship" . "/etc/restic/timo-battleship")
+ ("/var/backups/restic/timo/sync" . "/etc/restic/timo-sync")))))
(service secrets-service-type
(secrets-configuration