Subject: [PATCH 2/4] services: Add the Shepherd’s ‘transient’ and ‘timer’ to ‘%base-services’.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 17 Jan 2025 23:22:47 +0100

* gnu/services/base.scm (%base-services): Add instances of
‘shepherd-timer-service-type’ and ‘shepherd-transient-service-type’.

Change-Id: I28a35d0dce40b142ee71b330b1cf7a3d222ef6bd
---
 gnu/services/base.scm     |  4 ++++
 gnu/services/shepherd.scm | 34 ++++++++++++++++++----------------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 5967457002..7331c030d7 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -3750,6 +3750,10 @@ (define %base-services
 
         (service log-rotation-service-type)
 
+        ;; Convenient services brought by the Shepherd.
+        (service shepherd-timer-service-type)
+        (service shepherd-transient-service-type)
+
         ;; Periodically delete old build logs.
         (service log-cleanup-service-type
                  (log-cleanup-configuration
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 5f2625ac20..328bfbedff 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -678,14 +678,15 @@ (define user-processes-service-type
 (define shepherd-timer-service-type
   (shepherd-service-type
    'shepherd-timer
-   (const (shepherd-service
-           (provision '(timer))
-           (requirement '(user-processes))
-           (modules '((shepherd service timer)))
-           (free-form #~(timer-service
-                         '#$provision
-                         #:requirement '#$requirement))))
-   #t                                             ;ignored
+   (lambda (requirement)
+     (shepherd-service
+      (provision '(timer))
+      (requirement requirement)
+      (modules '((shepherd service timer)))
+      (free-form #~(timer-service
+                    '#$provision
+                    #:requirement '#$requirement))))
+   '(user-processes)
    (description "The Shepherd @code{timer} service lets you schedule commands
 dynamically, similar to the @code{at} command that your grandparents would use
 on that Slackware they got on a floppy disk.  For example, consider this
@@ -700,14 +701,15 @@ (define shepherd-timer-service-type
 (define shepherd-transient-service-type
   (shepherd-service-type
    'shepherd-transient
-   (const (shepherd-service
-           (provision '(transient))
-           (requirement '(user-processes))
-           (modules '((shepherd service transient)))
-           (free-form #~(transient-service
-                         '#$provision
-                         #:requirement '#$requirement))))
-   #t                                             ;ignored
+   (lambda (requirement)
+     (shepherd-service
+      (provision '(transient))
+      (requirement requirement)
+      (modules '((shepherd service transient)))
+      (free-form #~(transient-service
+                    '#$provision
+                    #:requirement '#$requirement))))
+   '(user-processes)
    (description "The Shepherd @code{transient} service lets you run commands
 asynchronously, in the background, similar to @command{systemd-run}, as in
 this example:
-- 
2.47.1