unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: 13/36: services: Add hurd-console-service-type.
Date: Fri, 01 May 2020 17:16:38 +0200	[thread overview]
Message-ID: <878sibr8h5.fsf@gnu.org> (raw)
In-Reply-To: <87v9lgljg8.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 01 May 2020 00:03:51 +0200")

Ludovic Courtès writes:

> guix-commits@gnu.org skribis:
>
>> commit d7a217e67dcd3b14402d746f4428db8545ce83f2
>> Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
>> AuthorDate: Mon Apr 13 10:13:05 2020 +0200
>>
>>     services: Add hurd-console-service-type.
>>     
>>     * gnu/services/hurd.scm (<hurd-console-configuration>): New variable.
>>     (hurd-console-shepherd-service, hurd-console-service-type): New function.
>>     (hurd-service->shepherd-service): Add entry.
>
> Now for the exciting stuff, neat!

\o/

>> -  #:export (hurd-service->shepherd-service))
>> +  #:export (hurd-console-service-type
>> +            hurd-service->shepherd-service))
>>  
>>  ;;; Commentary:
>>  ;;;
>> @@ -38,9 +39,51 @@
>>  (define (hurd-service->shepherd-service service)
>>    (let ((config (service-value service)))
>>      (match config
>> +      (($ <hurd-console-configuration>) (hurd-console-shepherd-service config))
>>        (_ '()))))
>
> Hmm do we really need this ‘hurd-service->shepherd-service’ procedure?
> I haven’t read the rest, but it seems surprising at first sight.

We certainly don't need it.  The patch/hunk above is being cut very
unfortunately; it loses the one interesting comment just one line
earlier, which was introduced by the privous (mosttly empty) commit:

    +;; XXX Gradually bootstrap (gnu services) framework.
    +(define (hurd-service->shepherd-service service)

The "XXX" comment is my attempt at implicitly communicating a question
that I had trouble formulating, two weeks ago.  The code that I could
not imagine how to write now looks something like this:

  (define shepherd.conf
    (with-parameters ((%current-target-system "i586-pc-gnu"))
      (shepherd-configuration-file
       (append-map list
                   (service-value
               (fold-services (operating-system-services os)
                              #:target-type
                              shepherd-root-service-type))))))

...but this does not work.  The problem here is that I currestly faked
"file-systems", "syslogd", "user-processes".  Those are needed to "get
past" the missing dependency checks for "openssh" and "guix-daemon".  I
have no idea how to write those yet, so would like to postpone them for
a bit.

However

  (define shepherd.conf
    (with-parameters ((%current-target-system "i586-pc-gnu"))
      (shepherd-configuration-file
       (filter
        (lambda (value)
          ;; XXX Remove file-systems, loopback, syslogd, user-processes
          ;; those are fake/don't work yet on the Hurd
          (pk "prov" (memq (car (shepherd-service-provision value))
                           '(console guix-daemon ssh-daemon ttys
                                     user-processes))))
        (service-value
         (fold-services (operating-system-services os)
                        #:target-type
                        shepherd-root-service-type))))))

this also does not work, because again, I get

    guix build: error: service 'user-processes' requires 'user-homes', which is not provided by any service

So...I just can't manage to bootstrap shepherd services into
"system/hurd.scm cross-hurd-image" without this intermediate
hurd-service->shepherd-service procedure.  Once we have working
implementations for all these services, hurd-service->shepherd-service
has become obsolete.

Now this

    guix system build --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl

has some cross-build problems, though.  Yesterday I finally managed to
pin-point the problem.  It lives between
expression->derivation-in-linux-vm

(define* (expression->derivation-in-linux-vm name exp
                                             #:key
                                             (system (%current-system)) target
                                             (linux linux-libre)
...

that is called by qemu-image.  So I have been playing with this hack

(define* (qemu-image #:key
                     (name "qemu-image")
                     (system (%current-system))
-                    (target (%current-target-system))
+                    (target (if (hurd-target?) #f (%current-target-system)))

Because when qemu-image has "target" set, then expression->derivation-in-linux-vm
will attempt to create a QEMU vm for that target and start in in
QEMU...but it needs a LINUX for that target and starts to cross-build
linux for i586-pc-gnu.  That build fails.

In our "guix build -f gnu/system/hurd.scm" setup ("hack"?) we call
qemu-image with target #f, build and run a VM-image using x86_64-linux
and manually cross-compile all packages that go inside.

I'll be trying to rewrite these services harder and use more of the
regular "guix system" way of handling services to plug that into
gnu/system/hurd.scm.

Meanwhile there is the vm-image question: can we somehow use
expression->derivation-in-linux-vm when running "guix system
... --target=i586-pc-gnu"?  Or do we want to create a
expression->derivation-in-hurd-vm?  Or do we leap onto the "explosive
mixture of wip-disk-image and wip-hurd-vm?  Once any of these solutions
work we can drop the gnu/system/hurd.scm cross-hurd-image workaround.

>> +  (list (shepherd-service
>> +         (documentation "Hurd console.")
>
> “Run the Hurd’s VGA console client.”

Ah, ok...that's what it is.

>> +         (provision '(console))
>> +         (requirement '())
>
> Should be '(user-processes) I think.

Ah yes, good catch.

>> +         (start #~(lambda _ (fork+exec-command #$console-command) #t))
>
> Rather #~(make-forkexec-constructor #$console-command).

Great, thanks!

>> +(define hurd-console-service-type
>> +  (service-type
>> +   (name 'console)
>> +   (description
>> +    "Run a hurd console, @command{console}.")
>
> Maybe “Run the Hurd console client.”

Thanks.

>> +   (compose concatenate)
>> +   (extend first-of-two)
>
> I don’t think we need these two fields since this service is not meant
> to be extensible.
>
>> +   (default-value (hurd-console-configuration))))
>
> Please add a ‘description’ too!

For the default value?  Isn't that added above...maybe i'm using a weird
layout for the fields?

I will be testing these changes and updating the other services
similarly.

> Also, normally we document every new service type in the manual, but
> maybe we can delay it here so that you can unleash your hack powers in
> the meantime.  :-)

I'm marking this as DRAFT and add a TODO in the message so that we don't
forget.  Let's not waste my hacking powers on documenting stuff too long
before it's merged...but also not forget the documentation.

Phew...

Greetings,
janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


  reply	other threads:[~2020-05-01 15:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200427101927.7020.76060@vcs0.savannah.gnu.org>
     [not found] ` <20200427101942.B725620A5E@vcs0.savannah.gnu.org>
2020-04-30 21:48   ` 02/36: gnu: guix: Use gnutls-3.6.13 when cross-compiling Ludovic Courtès
2020-05-01  7:22     ` Jan Nieuwenhuizen
     [not found] ` <20200427101943.A4BDD20A5E@vcs0.savannah.gnu.org>
2020-04-30 21:50   ` 05/36: vm: Make the device node procedure a parameter Ludovic Courtès
2020-05-01  6:07     ` Jan Nieuwenhuizen
2020-05-03 20:34       ` Ludovic Courtès
     [not found] ` <20200427101943.F251E20A5E@vcs0.savannah.gnu.org>
2020-04-30 21:51   ` 06/36: gnu: hurd: Fix references to /bin/w Ludovic Courtès
2020-05-01  6:07     ` Jan Nieuwenhuizen
     [not found] ` <20200427101944.46D0C20A5E@vcs0.savannah.gnu.org>
2020-04-30 21:52   ` 07/36: gnu: hurd: Use default Qemu guest ip: 10.0.2.15 Ludovic Courtès
2020-05-01  6:07     ` Jan Nieuwenhuizen
     [not found] ` <20200427101944.86DE020BC2@vcs0.savannah.gnu.org>
2020-04-30 21:53   ` 08/36: gnu: hurd: Add NFS support Ludovic Courtès
2020-05-01  6:14     ` Jan Nieuwenhuizen
     [not found] ` <20200427101945.023D020BC4@vcs0.savannah.gnu.org>
2020-04-30 21:55   ` 09/36: gnu: Add libtirpc/hurd Ludovic Courtès
2020-05-01  6:15     ` Jan Nieuwenhuizen
2020-04-30 21:56 ` branch wip-hurd-vm created (now fdb35e3) Ludovic Courtès
2020-05-01  7:02   ` Jan Nieuwenhuizen
     [not found] ` <20200427101946.414C420A5E@vcs0.savannah.gnu.org>
2020-04-30 22:03   ` 13/36: services: Add hurd-console-service-type Ludovic Courtès
2020-05-01 15:16     ` Jan Nieuwenhuizen [this message]
2020-05-01 20:03       ` Jan Nieuwenhuizen
2020-05-03 20:39       ` Ludovic Courtès
2020-05-03 20:55         ` Jan Nieuwenhuizen
     [not found] ` <20200427101947.E79D320A5E@vcs0.savannah.gnu.org>
2020-04-30 22:07   ` 18/36: services: hurd: Add dummy loopback Ludovic Courtès
2020-05-01 15:15     ` Jan Nieuwenhuizen
2020-05-03 20:50       ` Ludovic Courtès
2020-05-03 22:15         ` Jan Nieuwenhuizen
2020-05-05  9:23           ` Ludovic Courtès
2020-05-05  9:38             ` Vincent Legoll
2020-05-06 14:06               ` Ludovic Courtès
2020-05-05 12:46             ` Jan Nieuwenhuizen
2020-05-06 14:09               ` Ludovic Courtès
     [not found] ` <20200427101948.9B2B220A5E@vcs0.savannah.gnu.org>
2020-04-30 22:25   ` 20/36: system: hurd: Add the Shepherd Ludovic Courtès
2020-05-01 10:28     ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878sibr8h5.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).