diff options
Diffstat (limited to 'tw/services/restic.scm')
-rw-r--r-- | tw/services/restic.scm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tw/services/restic.scm b/tw/services/restic.scm index 7c912251..7deea24a 100644 --- a/tw/services/restic.scm +++ b/tw/services/restic.scm @@ -55,7 +55,15 @@ password-store entry.") (or (restic-local-repository? thing) (restic-rest-repository? thing))) +(define (restic-cache-policy repository) + "Choose a cache policy restic argument for operating on REPOSITORY." + (cond + ((restic-local-repository? repository) "--no-cache") + ((restic-rest-repository? repository) "--cleanup-cache") + (else (error "Unknown repository type" repository)))) + (define (set-restic-variables repository password-source) + "Return a gexp that sets the right environment variables to access REPOSITORY." (define repo-string (match repository (($ <restic-local-repository> path) @@ -247,7 +255,8 @@ true." #~(begin #$(set-restic-variables repo password) (execl #$(file-append restic "/bin/restic") - "restic" "forget" "--no-cache" + "restic" "forget" + #$(restic-cache-policy repo) #$@(arg-with-value "--prune" prune?) #$@(arg-with-value "--host" snapshot-host) #$@(arg-with-value "--path" snapshot-paths) @@ -317,7 +326,8 @@ must be given. Leading @code{~/} are replaced with @code{$HOME}.") path)) #$(set-restic-variables repo password) (apply execl #$(file-append restic "/bin/restic") - "restic" "backup" "--cleanup-cache" + "restic" "backup" + #$(restic-cache-policy repo) #$@(append-map (lambda (tag) (list "--tag" tag)) tags) (map replace-home '#$paths))))))) (map cronjob configs)) |