summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tw/services/restic.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/tw/services/restic.scm b/tw/services/restic.scm
index 68bab007..7c912251 100644
--- a/tw/services/restic.scm
+++ b/tw/services/restic.scm
@@ -228,6 +228,14 @@ true."
(($ <restic-rest-repository> _ _ _ _ path) path)))
#\/))
+ (define (norm-keep number)
+ ;; Guix' restic version doesn't seem to support "--keep-X=-1" to keep all
+ ;; snapshots in the specified interval, so pass a very high number instead.
+ (if (and (number? number)
+ (= -1 number))
+ 1000000
+ number))
+
(define (cronjob config)
(match-record config <restic-scheduled-cleanup>
(schedule repo password restic user snapshot-host snapshot-paths prune?
@@ -245,11 +253,11 @@ true."
#$@(arg-with-value "--path" snapshot-paths)
#$@(arg-with-value "--keep-within" keep-within)
#$@(arg-with-value "--keep-last" keep-last)
- #$@(arg-with-value "--keep-hourly" keep-hourly)
- #$@(arg-with-value "--keep-daily" keep-daily)
- #$@(arg-with-value "--keep-weekly" keep-weekly)
- #$@(arg-with-value "--keep-monthly" keep-monthly)
- #$@(arg-with-value "--keep-yearly" keep-yearly))))
+ #$@(arg-with-value "--keep-hourly" (norm-keep keep-hourly))
+ #$@(arg-with-value "--keep-daily" (norm-keep keep-daily))
+ #$@(arg-with-value "--keep-weekly" (norm-keep keep-weekly))
+ #$@(arg-with-value "--keep-monthly" (norm-keep keep-monthly))
+ #$@(arg-with-value "--keep-yearly" (norm-keep keep-yearly)))))
#$@(if (maybe-value-set? user) (list #:user user) '()))))
(map cronjob configs))