guix-commits
[Top][All Lists]
Advanced

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

21/22: system: hurd: Initial (gnu services) generated shepherd.conf.


From: guix-commits
Subject: 21/22: system: hurd: Initial (gnu services) generated shepherd.conf.
Date: Mon, 13 Apr 2020 09:20:51 -0400 (EDT)

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

commit d56b85f170920357905ca89110ff05fb907157f2
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Mon Apr 13 10:17:47 2020 +0200

    system: hurd: Initial (gnu services) generated shepherd.conf.
    
    * gnu/system/hurd.scm (%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/system/hurd.scm | 158 ++++++++++++++++++----------------------------------
 1 file changed, 55 insertions(+), 103 deletions(-)

diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index 88c2557..553e46e 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)
@@ -32,6 +33,11 @@
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages ssh)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services hurd)
+  #:use-module (gnu services ssh)
+  #:use-module (gnu system)
   #:use-module (gnu system vm)
   #:export (cross-hurd-image))
 
@@ -52,11 +58,58 @@
                       #: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 guix
         net-base inetutils openssh shepherd))
 
+(define %base-services/hurd
+  (let ((hurd (with-parameters ((%current-target-system
+                                 "i586-pc-gnu"))
+                hurd))
+        (guix (with-parameters ((%current-target-system
+                                 "i586-pc-gnu"))
+                guix))
+        (openssh (with-parameters ((%current-target-system
+                                 "i586-pc-gnu"))
+                openssh)))
+    (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 hurd-ssh-service-type
+                   (openssh-configuration
+                    (use-pam? #f)
+                    (openssh openssh)
+                    (port-number 2222)
+                    (permit-root-login #t)
+                    (allow-empty-passwords? #t)
+                    (password-authentication? #t)))
+          (service guix-service-type
+                   (guix-configuration
+                    (guix guix)
+                    (extra-options '("--disable-chroot"
+                                     "--disable-deduplication"
+                                     "--max-jobs=1"))))
+          (service hurd-console-service-type
+                   (hurd-console-configuration (hurd hurd) (fancy? #t))))))
+
+(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."
 
@@ -138,105 +191,8 @@ if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
   . \"$GUIX_PROFILE/etc/profile\"
 fi\n"))
 
-  (define sshd_config
-    (plain-file "sshd_config"
-                "# Generated by '(gnu system hurd)'
-Port 22
-PermitRootLogin yes
-PermitEmptyPasswords yes
-PasswordAuthentication yes
-PubkeyAuthentication yes
-PidFile /var/run/sshd.pid
-PrintLastLog yes
-LogLevel INFO\n"))
-
   (define shepherd.conf
-    (plain-file "shepherd.conf"
-                ";; -*-scheme-*- # Generated by '(gnu system hurd)'
-;; shepherd --config /etc/shepherd.conf
-
-(use-modules (srfi srfi-1)
-             (srfi srfi-34)
-             (system repl error-handling)
-             (oop goops)
-             (shepherd service))
-
-(default-environment-variables
-  '(\"PATH=/run/current-system/profile/bin\"))
-(call-with-error-handling
- (lambda _
-   (apply
-    register-services
-    (list
-     (make <service>
-       #:provides '(console)
-       #:respawn? #t
-       #:start (lambda _
-                 (fork+exec-command
-                  '(\"/run/current-system/profile/bin/console\"
-                    \"-c\" \"/dev/vcs\"
-                    \"-d\" \"vga\"
-                    \"-d\" \"pc_kbd\"
-                    \"-d\" \"generic_speaker\")))
-       #:stop (make-kill-destructor))
-     (make <service>
-       #:provides '(ttys)
-       #:requires '(console)
-       #:respawn? #t
-       #:start (lambda _
-                 (fork+exec-command
-                  '(\"/run/current-system/profile/libexec/runttys\")))
-       #:stop (make-kill-destructor))
-     (make <service>
-       #:provides '(fancy-console)
-       #:requires '(ttys)
-       #:respawn? #t
-       #:start (lambda _
-                 (fork+exec-command
-                  '(\"/run/current-system/profile/bin/console\"
-                    \"-c\" \"/dev/vcs\"
-                    \"-d\" \"vga\"
-                    \"-d\" \"pc_kbd\"
-                    \"-d\" \"generic_speaker\")))
-       #:stop (make-kill-destructor))
-     (make <service>
-       #:provides '(guix-daemon)
-       #:respawn? #t
-       #:start (lambda _
-                 (fork+exec-command
-                  '(\"/run/current-system/profile/bin/guix-daemon\"
-                    \"--build-users-group=guixbuild\"
-                    \"--disable-chroot\"
-                    \"--disable-deduplication\"
-                    \"--max-jobs=1\"
-                    \"--substitute-urls=https://ci.guix.gnu.org\";)))
-       #:stop (make-kill-destructor))
-     (make <service>
-       #:provides '(ssh-daemon ssh sshd)
-       #:respawn? #t
-       #:start (lambda _
-                 (fork+exec-command
-                  '(\"/run/current-system/profile/sbin/sshd\"
-                    \"-D\"
-                    \"-f\" \"/etc/ssh/sshd_config\")))
-       #:stop (make-kill-destructor))))))
-(format #t \"starting services...~%\")
-(for-each
- (lambda (service)
-   (guard (c ((service-error? c) (format (current-error-port) \"failed to 
start service '~a'~%\" service)))
-     (start service)))
- '(console ttys fancy-console guix-daemon ssh-daemon ssh sshd))
-(redirect-port (open-input-file \"/dev/null\") (current-input-port))\n")) ;" 
help Emacs
-
-  (define build.sh
-    (plain-file "build.sh"
-                "#! /bin/sh
-set -ex
-
-guix-daemon --build-users-group=guixbuild --disable-chroot 
--disable-deduplication --max-jobs=1 &
-guix archive --authorize < 
/run/current-system/profile/share/guix/ci.guix.gnu.org.pub
-guix build -e '(@@ (gnu packages commencement) gnu-make-boot0)' --fallback 
--no-offload
-"))
+    (shepherd-configuration-file (hurd-shepherd-services %hurd-os)))
 
   (define hurd-directives
     `((directory "/servers")
@@ -267,7 +223,6 @@ guix build -e '(@@ (gnu packages commencement) 
gnu-make-boot0)' --fallback --no-
               '(begin
                  (use-modules (ice-9 readline) (ice-9 colorized))
                  (activate-readline) (activate-colorized))))
-      ("/root/build.sh" -> ,build.sh)
       (directory "/run")
       (directory "/run/current-system")
       ("/run/current-system/profile" -> ,system-profile)
@@ -303,7 +258,6 @@ guix build -e '(@@ (gnu packages commencement) 
gnu-make-boot0)' --fallback --no-
                                       hurd)
                                     "/etc/ttys"))
       (directory "/etc/ssh")
-      ("/etc/ssh/sshd_config" -> ,sshd_config)
       ("/etc/shepherd.conf" -> ,shepherd.conf)
       ("/bin/sh" -> ,(file-append (with-parameters ((%current-target-system
                                                      "i586-pc-gnu"))
@@ -320,9 +274,7 @@ guix build -e '(@@ (gnu packages commencement) 
gnu-make-boot0)' --fallback --no-
                          ("group" ,group)
                          ("etc-profile" ,etc-profile)
                          ("shadow" ,shadow)
-                         ("sshd_config" ,sshd_config)
-                         ("shepherd.conf" ,shepherd.conf)
-                         ("build.sh" ,build.sh))
+                         ("shepherd.conf" ,shepherd.conf))
               #:copy-inputs? #t
               #:os system-profile
               #:bootcfg-drv grub.cfg



reply via email to

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