From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0GCCFZw9rF5iZwAA0tVLHw (envelope-from ) for ; Fri, 01 May 2020 15:17:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4OqMG6U9rF6GfAAA1q6Kng (envelope-from ) for ; Fri, 01 May 2020 15:17:57 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5CAF394121A for ; Fri, 1 May 2020 15:17:56 +0000 (UTC) Received: from localhost ([::1]:36812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUXQK-0003L0-EJ for larch@yhetil.org; Fri, 01 May 2020 11:17:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44754) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUXP7-0001wl-SE for guix-devel@gnu.org; Fri, 01 May 2020 11:17:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56961) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUXP7-0006px-El; Fri, 01 May 2020 11:16:41 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=42404 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jUXP5-0003zR-EQ; Fri, 01 May 2020 11:16:39 -0400 From: Jan Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: 13/36: services: Add hurd-console-service-type. Organization: AvatarAcademy.nl References: <20200427101927.7020.76060@vcs0.savannah.gnu.org> <20200427101946.414C420A5E@vcs0.savannah.gnu.org> <87v9lgljg8.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Fri, 01 May 2020 17:16:38 +0200 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") Message-ID: <878sibr8h5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49530124165899]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.16), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; HAS_ORG_HEADER(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[janneke@gnu.org,guix-devel-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[avataracademy.com:url,joyofsource.com:url,gnu.org:email,lilypond.org:url]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[gnu.org]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[2001:470:142::17:from]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: azZnAk69Bdj3 Ludovic Court=C3=A8s writes: > guix-commits@gnu.org skribis: > >> commit d7a217e67dcd3b14402d746f4428db8545ce83f2 >> Author: Jan (janneke) Nieuwenhuizen >> AuthorDate: Mon Apr 13 10:13:05 2020 +0200 >> >> services: Add hurd-console-service-type. >>=20=20=20=20=20 >> * gnu/services/hurd.scm (): New variable. >> (hurd-console-shepherd-service, hurd-console-service-type): New func= tion. >> (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)) >>=20=20 >> ;;; Commentary: >> ;;; >> @@ -38,9 +39,51 @@ >> (define (hurd-service->shepherd-service service) >> (let ((config (service-value service))) >> (match config >> + (($ ) (hurd-console-shepherd-service = config)) >> (_ '())))) > > Hmm do we really need this =E2=80=98hurd-service->shepherd-service=E2=80= =99 procedure? > I haven=E2=80=99t 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', whic= h 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=3Di586-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)) tar= get (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-li= nux-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=3Di586-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.") > > =E2=80=9CRun the Hurd=E2=80=99s VGA console client.=E2=80=9D 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 =E2=80=9CRun the Hurd console client.=E2=80=9D Thanks. >> + (compose concatenate) >> + (extend first-of-two) > > I don=E2=80=99t think we need these two fields since this service is not = meant > to be extensible. > >> + (default-value (hurd-console-configuration)))) > > Please add a =E2=80=98description=E2=80=99 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 --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com