Subject: [WIP 4/6] services: kernel-module-loader: Return a single 'shepherd-service'.

From: Brice Waegeneire <[email-masked]>
Date: Sat, 4 Jul 2020 20:54:29 +0200

* gnu/services/linux.scm (kernel-module-loader-shepherd-service): Return
a 'shepherd-service' instead of a list of it.
(kernel-module-loader-service-type): Adjust it.
---
 gnu/services/linux.scm | 59 +++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm
index c608cc4d8d..7ea30a1270 100644
--- a/gnu/services/linux.scm
+++ b/gnu/services/linux.scm
@@ -140,35 +140,34 @@ representation."
 (define kernel-module-loader-shepherd-service
   (match-lambda
     ((and (? list? kernel-modules) ((? string?) ...))
-     (list
-      (shepherd-service
-       (documentation "Load kernel modules.")
-       (provision '(kernel-module-loader))
-       (requirement '(file-systems))
-       (one-shot? #t)
-       (modules `((srfi srfi-1)
-                  (srfi srfi-34)
-                  (srfi srfi-35)
-                  (rnrs io ports)
-                  ,@%default-modules))
-       (start
-        #~(lambda _
-            (cond
-             ((null? '#$kernel-modules) #t)
-             ((file-exists? "/proc/sys/kernel/modprobe")
-              (let ((modprobe (call-with-input-file
-                               "/proc/sys/kernel/modprobe" get-line)))
-                (guard (c ((message-condition? c)
-                           (format (current-error-port) "~a~%"
-                                   (condition-message c))
-                           #f))
-                  (every (lambda (module)
-                         (invoke/quiet modprobe "--" module))
-                         '#$kernel-modules))))
-             (else
-               (format (current-error-port) "error: ~a~%"
-                       "Kernel is missing loadable module support.")
-               #f)))))))))
+     (shepherd-service
+      (documentation "Load kernel modules.")
+      (provision '(kernel-module-loader))
+      (requirement '(file-systems))
+      (one-shot? #t)
+      (modules `((srfi srfi-1)
+                 (srfi srfi-34)
+                 (srfi srfi-35)
+                 (rnrs io ports)
+                 ,@%default-modules))
+      (start
+       #~(lambda _
+           (cond
+            ((null? '#$kernel-modules) #t)
+            ((file-exists? "/proc/sys/kernel/modprobe")
+             (let ((modprobe (call-with-input-file
+                                 "/proc/sys/kernel/modprobe" get-line)))
+               (guard (c ((message-condition? c)
+                          (format (current-error-port) "~a~%"
+                                  (condition-message c))
+                          #f))
+                 (every (lambda (module)
+                          (invoke/quiet modprobe "--" module))
+                        '#$kernel-modules))))
+            (else
+             (format (current-error-port) "error: ~a~%"
+                     "Kernel is missing loadable module support.")
+             #f))))))))
 
 (define kernel-module-loader-service-type
   (service-type
@@ -176,7 +175,7 @@ representation."
    (description "Load kernel modules.")
    (extensions
     (list (service-extension shepherd-root-service-type
-                             kernel-module-loader-shepherd-service)))
+                             (compose list kernel-module-loader-shepherd-service))))
    (compose concatenate)
    (extend append)
    (default-value '())))
-- 
2.26.2