Hello!

Felix Lechner via "Development of GNU Guix and the GNU System
distribution." <guix-devel@gnu.org> skribis:

> (define (garbage-collector-shepherd-service config)

FWIW, if it can help, I have something very similar in my config:

--8<---------------cut here---------------start------------->8---
(define %gc-service
  (simple-service
   'gc shepherd-root-service-type
   (list (shepherd-service
          (provision '(gc))
          (requirement '(user-processes))
          (modules '((shepherd service timer)))
          (start #~(make-timer-constructor
                    (calendar-event #:minutes '(0))
                    (command '("/run/current-system/profile/bin/guix" "gc" 
"-F2G")
                             #:user "ludo")))
          (stop #~(make-timer-destructor))
          (documentation "Run the garbage collector (GC).")
          (actions
           (list (shepherd-action
                  (name 'trigger)
                  (documentation "GC!")
                  (procedure #~trigger-timer))))))))
--8<---------------cut here---------------end--------------->8---

… and I add ‘%gc-service’ to my ‘services’ field.

Works as advertised:

--8<---------------cut here---------------start------------->8---
$ sudo /run/current-system/profile/bin/herd status gc
Password: 
Status of gc:
  It is running since Mon 27 May 2024 08:39:28 AM CEST (5 days ago).
  Timed service.
  Periodically running as "ludo": /run/current-system/profile/bin/guix gc -F2G.
  It is enabled.
  Provides: gc.
  Requires: user-processes.
  Will be respawned.

Recent runs:
  2024-05-31 21:00:00 Process exited successfully after 0 seconds.
  2024-05-31 22:00:00 Process exited successfully after 0 seconds.
  2024-05-31 23:00:00 Process exited successfully after 0 seconds.
  2024-06-01 00:00:00 Process exited successfully after 0 seconds.
  2024-06-01 01:00:00 Process exited successfully after 0 seconds.
  2024-06-01 11:00:00 Process exited successfully after 0 seconds.
  2024-06-01 12:00:00 Process exited successfully after 0 seconds.
  2024-06-01 13:00:00 Process exited successfully after 0 seconds.
  2024-06-01 14:00:00 Process exited successfully after 0 seconds.
  2024-06-01 15:00:00 Process exited successfully after 0 seconds.

Recent messages:
  2024-06-01 15:00:00 guix gc: already 4169.06 MiBs available on /gnu/store, 
nothing to do

Upcoming timer alarms:
  04:00:00 PM (in 37 minutes)
  05:00:00 PM (in 97 minutes)
  06:00:00 PM (in 3 hours)
  07:00:00 PM (in 4 hours)
  08:00:00 PM (in 5 hours)
--8<---------------cut here---------------end--------------->8---

HTH!

Ludo’.

Reply via email to