guix-commits
[Top][All Lists]
Advanced

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

23/48: system: hurd: Add the Shepherd.


From: guix-commits
Subject: 23/48: system: hurd: Add the Shepherd.
Date: Sun, 19 Apr 2020 10:22:13 -0400 (EDT)

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

commit 5a3b002cd0df9efb8b4b5b88b8d23c0fdbfe7f86
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   | 43 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 50 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 6925cbd..ce64d2b 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)
@@ -30,6 +31,10 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
   #:use-module (gnu packages hurd)
+  #: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))
 
@@ -50,10 +55,38 @@
                       #: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))
+        net-base inetutils shepherd))
+
+(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)))
+        (service guix-service-type
+                 (guix-configuration
+                  (guix guix)
+                  (extra-options '("--disable-chroot"
+                                   "--disable-deduplication"
+                                   "--max-jobs=1"))))))
+
+(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."
@@ -135,6 +168,9 @@ if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
   . \"$GUIX_PROFILE/etc/profile\"
 fi\n"))
 
+  (define shepherd.conf
+    (shepherd-configuration-file (hurd-shepherd-services %hurd-os)))
+
   (define hurd-directives
     `((directory "/servers")
       ,@(map (lambda (server)
@@ -198,6 +234,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)
@@ -212,13 +249,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]