summaryrefslogtreecommitdiff
path: root/tw/home/lap.scm
diff options
context:
space:
mode:
authorTimo Wilken2023-11-01 23:10:16 +0100
committerTimo Wilken2023-11-01 23:10:16 +0100
commit6812d052650b62a090852101bad99dd48a964c19 (patch)
tree80c4f811522fccd981956fe5f04c93752350ee58 /tw/home/lap.scm
parent9b57cf604c1544ca63dea1a454f696b02002c8f3 (diff)
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
Diffstat (limited to 'tw/home/lap.scm')
-rw-r--r--tw/home/lap.scm35
1 files changed, 18 insertions, 17 deletions
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