From 6812d052650b62a090852101bad99dd48a964c19 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Wed, 1 Nov 2023 23:10:16 +0100 Subject: Generalise Restic declarations * rename confusingly named restic-*-repository variables to restic-scheduled-* * generalise repository handling, allowing local and REST repositories both as backup and cleanup targets * generalise password handling, allowing passwords from pass or from files for backup, for cleanup and as part of a REST URL --- tw/home/lap.scm | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'tw/home/lap.scm') diff --git a/tw/home/lap.scm b/tw/home/lap.scm index 6b7e1516..7268617d 100644 --- a/tw/home/lap.scm +++ b/tw/home/lap.scm @@ -94,6 +94,17 @@ (password-eval "pass www/mythic-beasts/email/timo | head -1")))))) (default-account "mythic"))))) +(define (restic-pass-key key) + (restic-password-source (type 'pass) (name key))) + +(define (restic-vin.wg-repo path) + (restic-rest-repository + (username "timo") + (password (restic-pass-key "computers/vin/restic-server/timo")) + (hostname "vin.wg") + (port 8181) + (path path))) + (define-public %lap-home (home-environment (packages @@ -127,7 +138,7 @@ `(("congard/NVSM.conf" ,(local-file "files/NVSM.conf")))) (service home-restic-backup-service-type - (list (restic-backup-repository + (list (restic-scheduled-backup (schedule #~"0 */2 * * *") (paths '(;; important user data "~/documents" @@ -148,15 +159,10 @@ "~/.local/share/widelands" "~/.local/share/guix-sandbox-home/.local/share/Colossal Order/Cities_Skylines" "~/.local/share/guix-sandbox-home/.local/share/Surviving Mars")) - (url (restic-rest-repository - (username "timo") - (password-key "computers/vin/restic-server/timo") - (hostname "vin.wg") - (port 8181) - (path "timo/laptop"))) - (password-key "computers/vin/restic-repos/laptop")) - - (restic-backup-repository + (repo (restic-vin.wg-repo "timo/laptop")) + (password (restic-pass-key "computers/vin/restic-repos/laptop"))) + + (restic-scheduled-backup (schedule #~"10 */2 * * *") (paths '("~/audiobooks" "~/music" @@ -164,13 +170,8 @@ "~/sync" "~/videos/youtube/.yt-dlp" "~/videos/youtube/.config")) - (url (restic-rest-repository - (username "timo") - (password-key "computers/vin/restic-server/timo") - (hostname "vin.wg") - (port 8181) - (path "timo/sync"))) - (password-key "computers/vin/restic-repos/sync")))) + (repo (restic-vin.wg-repo "timo/sync")) + (password (restic-pass-key "computers/vin/restic-repos/sync"))))) ;; Redshift: make the screen turn redder at night. (service home-redshift-service-type -- cgit v1.2.3