summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-02-04 10:00:50 +0000
committerChristopher Baines <mail@cbaines.net>2022-02-04 10:09:01 +0000
commit71d2bdfa9fce546e8d8d5103aee4e1096ce65ecf (patch)
treebbdb35be712f18cea14c0d534962c3eea43a874a /gnu/services
parentff093f5739a61e77b296feccc48d260b9bb574c0 (diff)
downloadguix-71d2bdfa9fce546e8d8d5103aee4e1096ce65ecf.tar.gz
services: nar-herder: Support ttl and negative-ttl options.
* gnu/services/guix.scm (<nar-herder-configuration>): Add ttl and negative-ttl
fields.
(nar-herder-shepherd-services): Pass the ttl and negative-ttl values to the
service.
* doc/guix.texi (Guix Services): Document this.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/guix.scm18
1 files changed, 15 insertions, 3 deletions
diff --git a/gnu/services/guix.scm b/gnu/services/guix.scm
index 6a5b276b33..dc9bd8ad68 100644
--- a/gnu/services/guix.scm
+++ b/gnu/services/guix.scm
@@ -774,7 +774,12 @@ ca-certificates.crt file in the system profile."
                  (default "none"))
   (storage-nar-removal-criteria
    nar-herder-configuration-storage-nar-removal-criteria
-   (default '())))
+   (default '()))
+  (ttl           nar-herder-configuration-ttl
+                 (default #f))
+  (negative-ttl  nar-herder-configuration-negative-ttl
+                 (default #f)))
+
 
 (define (nar-herder-shepherd-services config)
   (match-record config <nar-herder-configuration>
@@ -782,7 +787,8 @@ ca-certificates.crt file in the system profile."
              mirror
              database database-dump
              host port
-             storage storage-limit storage-nar-removal-criteria)
+             storage storage-limit storage-nar-removal-criteria
+             ttl negative-ttl)
 
     (unless (or mirror storage)
       (error "nar-herder: mirror or storage must be set"))
@@ -817,7 +823,13 @@ ca-certificates.crt file in the system profile."
                                  (match criteria
                                    ((k . v) (simple-format #f "~A=~A" k v))
                                    (str str))))
-                              storage-nar-removal-criteria))
+                              storage-nar-removal-criteria)
+                      #$@(if ttl
+                             (list (string-append "--ttl=" ttl))
+                             '())
+                      #$@(if negative-ttl
+                             (list (string-append "--negative-ttl=" negative-ttl))
+                             '()))
                 #:user #$user
                 #:group #$group
                 #:pid-file "/var/run/nar-herder/pid"