guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

29/36: system: hurd: Add the Shepherd.


From: guix-commits
Subject: 29/36: system: hurd: Add the Shepherd.
Date: Fri, 24 Apr 2020 08:14:13 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 0b2f2a926752844f57272cab935a2feec9a17f26
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Tue Apr 7 08:03:03 2020 +0200

    system: hurd: Add the Shepherd.
    
    This starts console and ttys using the Shepherd.  Shepherd is not running as
    PID 1 yet, its started from `rc'.
    
    * gnu/system/hurd.scm (%base-packages/hurd): Add "shepherd".
    (%base-services/hurd): New variable.
    (%hurd-os): New variable.
    (hurd-shepherd-services): New function.
    (cross-hurd-image): Use them to generate an (unused and incomplete) ...
    (shepherd.conf): Generate from services defined in
    %hurd-os.
    * gnu/packages/hurd.scm (hurd-rc-script): Do not start console, start the
    shepherd instead.
    (hurd)[arguments]: Create pty devices.
    * gnu/system/hurd.scm (shepherd.conf): New file.
---
 gnu/packages/hurd.scm | 14 +++++++++-----
 gnu/system/hurd.scm   | 38 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index dd75879..2637883 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -349,10 +349,13 @@ boot, since this cannot be done from GNU/Linux."
                          (apply invoke "settrans" "-c" node command))))
                     '#$translators)
 
-          ;; Start the oh-so-fancy console client.
-          (mkdir-p "/var/run")                    ;for the PID file
-          (invoke "console" "--daemonize" "-c" "/dev/vcs"
-                  "-d" "vga" "-d" "pc_kbd" "-d" "generic_speaker"))))
+          ;; Generate the ssh host keys.
+          (invoke "/run/current-system/profile/bin/ssh-keygen" "-A")
+          (mkdir-p "/var/run")                    ;for the PID files
+          ;; Hand over to the Shepherd
+          (false-if-exception (delete-file "/var/run/shepherd/socket"))
+          (invoke "/run/current-system/profile/bin/shepherd"
+                  "--config" "/etc/shepherd.conf"))))
 
   ;; FIXME: We want the program to use the cross-compiled Guile when
   ;; cross-compiling.  But why do we need to be explicit here?
@@ -469,7 +472,8 @@ fsysopts / --writable
 # MAKEDEV relies on pipes so this needs to be set up.
 settrans -c /servers/socket/1 /hurd/pflocal
 
-(cd /dev; MAKEDEV -D /dev std vcs tty{1,2,3,4,5,6})\n")))
+(cd /dev; MAKEDEV -D /dev std vcs tty{1,2,3,4,5,6})
+(cd /dev; MAKEDEV -D /dev ptyp{0,1,2,3})\n")))
 
                (substitute* "daemons/runsystem.hurd.sh"
                  (("export PATH")
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index 28ef7cf..f0a4040 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -18,6 +18,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu system hurd)
+  #:use-module (srfi srfi-1)
   #:use-module (guix gexp)
   #:use-module (guix profiles)
   #:use-module (guix utils)
@@ -31,6 +32,10 @@
   #:use-module (gnu packages guile-xyz)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages less)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services hurd)
+  #:use-module (gnu system)
   #:use-module (gnu system vm)
   #:export (cross-hurd-image))
 
@@ -51,10 +56,32 @@
                       #:system system
                       #:target target))
 
+;; XXX: We will replace this by addding (gnu services shepherd).
+(define shepherd-configuration-file
+  (@@ (gnu services shepherd) shepherd-configuration-file))
+
 (define %base-packages/hurd
   (list hurd bash coreutils file findutils grep sed
         guile-3.0 guile-colorized guile-readline
-        net-base inetutils less which))
+        net-base inetutils less shepherd which))
+
+(define %base-services/hurd
+  (list (service hurd-user-processes-service-type)
+        (service hurd-console-service-type
+                 (hurd-console-configuration (hurd hurd)))
+        (service hurd-ttys-service-type
+                 (hurd-ttys-configuration (hurd hurd)))))
+
+(define %hurd-os
+  (operating-system
+    (host-name "guixygnu")
+    (bootloader #f)
+    (file-systems '())
+    (timezone "GNUrope")
+    (services %base-services/hurd)))
+
+(define (hurd-shepherd-services os)
+  (append-map hurd-service->shepherd-service (operating-system-services os)))
 
 (define* (cross-hurd-image #:key (hurd hurd) (gnumach gnumach))
   "Return a cross-built GNU/Hurd image."
@@ -136,6 +163,10 @@ if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
   . \"$GUIX_PROFILE/etc/profile\"
 fi\n"))
 
+  (define shepherd.conf
+    (with-parameters ((%current-target-system "i586-pc-gnu"))
+      (shepherd-configuration-file (hurd-shepherd-services %hurd-os)))))
+
   (define hurd-directives
     `((directory "/servers")
       ,@(map (lambda (server)
@@ -199,6 +230,7 @@ fi\n"))
                                                        "i586-pc-gnu"))
                                       hurd)
                                     "/etc/ttys"))
+      ("/etc/shepherd.conf" -> ,shepherd.conf)
       ("/bin/sh" -> ,(file-append (with-parameters ((%current-target-system
                                                      "i586-pc-gnu"))
                                     bash)
@@ -213,13 +245,15 @@ fi\n"))
                          ("passwd" ,passwd)
                          ("group" ,group)
                          ("etc-profile" ,etc-profile)
-                         ("shadow" ,shadow))
+                         ("shadow" ,shadow)
+                         ("shepherd.conf" ,shepherd.conf))
               #:copy-inputs? #t
               #:os system-profile
               #:bootcfg-drv grub.cfg
               #:bootloader grub-bootloader
               #:register-closures? #f
               #:device-nodes 'hurd
+              #:disk-image-size (* 10 (expt 2 30)) ;10GiB
               #:extra-directives hurd-directives))
 
 ;; Return this thunk so one can type "guix build -f gnu/system/hurd.scm".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]