diff options
author | Timo Wilken | 2023-11-02 20:35:05 +0100 |
---|---|---|
committer | Timo Wilken | 2023-11-02 20:35:05 +0100 |
commit | 0958e3c43ae0bc8c0c7b201b65a63474c0faedb5 (patch) | |
tree | ea549856cac72f690f534a71c5e922afe4f62778 /tw/services/restic.scm | |
parent | 0778378249c4f65bfd3cda84e425df4e19eff3d9 (diff) |
Fix Guix' restic's apparent lack of support for --keep-X=-1
Diffstat (limited to 'tw/services/restic.scm')
-rw-r--r-- | tw/services/restic.scm | 18 |
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)) |