summary refs log tree commit diff
path: root/gnu/services.scm
diff options
context:
space:
mode:
authorJan (janneke) Nieuwenhuizen <janneke@gnu.org>2020-04-30 15:40:07 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2020-06-08 14:26:14 +0200
commit68d8c094659565fe19abc1c433a17337ce5cacb7 (patch)
tree4f97b2413193eab93839f647a5cdcca9575dab7b /gnu/services.scm
parentb37c544196898cc3dfa3da07ed344fbe11abc120 (diff)
downloadguix-68d8c094659565fe19abc1c433a17337ce5cacb7.tar.gz
gnu: services: Add %hurd-startup-service.
This decouples startup of the Hurd from the "hurd" package, moving the RC
script into SYSTEM.

* gnu/packages/hurd.scm (hurd)[inputs]: Remove hurd-rc-script.
[arguments]: Do not substitute it.  Update "runsystem.sh" to parse kernel
arguments and exec into --system=SYSTEM/rc.
(hurd-rc-script): Move to...
* gnu/services.scm (%hurd-rc-file): ...this new variable.
(hurd-rc-entry): New procedure.
(%hurd-startup-service): Use it in new variable.
* gnu/system.scm (hurd-default-essential-services): Use it.
Diffstat (limited to 'gnu/services.scm')
-rw-r--r--gnu/services.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 63a709fc95..27e5558231 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -93,6 +93,8 @@
             activation-service-type
             activation-service->script
             %linux-bare-metal-service
+            %hurd-rc-script
+            %hurd-startup-service
             special-files-service-type
             extra-special-file
             etc-service-type
@@ -605,6 +607,39 @@ ACTIVATION-SCRIPT-TYPE."
                   activation-service-type
                   %linux-kernel-activation))
 
+(define %hurd-rc-script
+  ;; The RC script to be started upon boot.
+  (program-file "rc"
+                (with-imported-modules (source-module-closure
+                                        '((guix build utils)
+                                          (gnu build hurd-boot)
+                                          (guix build syscalls)))
+                  #~(begin
+                      (use-modules (guix build utils)
+                                   (gnu build hurd-boot)
+                                   (guix build syscalls)
+                                   (ice-9 match)
+                                   (system repl repl)
+                                   (srfi srfi-1)
+                                   (srfi srfi-26))
+                      (boot-hurd-system)))))
+
+(define (hurd-rc-entry rc)
+  "Return, as a monadic value, an entry for the RC script in the system
+directory."
+  (mlet %store-monad ((rc (lower-object rc)))
+    (return `(("rc" ,rc)))))
+
+(define hurd-startup-service-type
+  ;; The service that creates the initial SYSTEM/rc startup file.
+  (service-type (name 'startup)
+                (extensions
+                 (list (service-extension system-service-type hurd-rc-entry)))
+                (default-value %hurd-rc-script)))
+
+(define %hurd-startup-service
+  ;; The service that produces the RC script.
+  (service hurd-startup-service-type %hurd-rc-script))
 
 (define special-files-service-type
   ;; Service to install "special files" such as /bin/sh and /usr/bin/env.