From: "Ludovic Courtès" <ludo@gnu.org>
To: "Jan \(janneke\) Nieuwenhuizen" <janneke@gnu.org>
Cc: Mathieu Othacehe <othacehe@gnu.org>, 41785@debbugs.gnu.org
Subject: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'.
Date: Thu, 11 Jun 2020 21:59:50 +0200 [thread overview]
Message-ID: <87eeql9xvt.fsf@gnu.org> (raw)
In-Reply-To: <20200610085441.890-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Wed, 10 Jun 2020 10:54:41 +0200")
Hey!
That was fast! :-)
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> and doing something like
>
> ./pre-inst-env guix system vm gnu/system/examples/bare-bones.tmpl --no-offload
> /gnu/store/96wh3jwsla4p6d4s547mmqxsi4qbbc0r-run-vm.sh -m 2G \
> --device rtl8139,netdev=net0 \
> --netdev user,id=net0,hostfwd=tcp:127.0.0.1:10022-:2222,hostfwd=tcp:127.0.0.1:5900-:5900
>
> nicely starts a bare-bones VM with the the hurd-in-vm service inside, but I
> cannot seem to connect to the Hurd VM it in any way. Appending
> ",hostfwd=tcp:127.0.0.1:20022-:20022" (to directly ssh into the Hurd) even
> blocks me from ssh'ing into the GNU/linux host VM.
Weird.
> hurd-in-vm works beautifully when added to my system configuration and
> reconfiguring.
>
> * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-service,
> hurd-vm-disk-image): New procedures.
> (%hurd-in-vm-operating-system, hurd-in-vm-service-type): New variable.
> (<hurd-in-vm-configuration>): New record type.
> * doc/guix.texi (Virtualization Services): Document it.
[…]
> +@subsubheading The Hurd in a Virtual Machine
> +
> +@cindex @code{hurd}
> +@cindex the Hurd
> +
> +Service @code{hurd-in-vm} provides support for running a Virtual Machine
> +with the GNU@tie{}Hurd.
“… support for running GNU/Hurd in a virtual machine (VM). The virtual
machine is a Shepherd service that can be controlled with commands such
as:
@example
herd stop hurd-vm
@end example
The given GNU/Hurd operating system configuration is cross-compiled.”
Nitpick: I’d call it “hurd-vm”, because it runs a Hurd VM. :-)
It’s a volatile VM, due to the use of ‘-snapshot’, right?
(The Hurd actually has “sub-Hurds”¹ and “neighborhurds”². I wonder if
it’s our duty to coin another term… a guesthurd? a visithurd?)
¹ https://www.gnu.org/software/hurd/hurd/subhurd.html
² https://www.gnu.org/software/hurd/hurd/neighborhurd.html
> +(define* (disk-image os #:key (image-size 'guess) target)
> + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET."
> + (with-store store
^
In general, procedures should talk to the user-provided store and never
open a new connection. They should also never call ‘build-derivations’
explicitly, the only exception so far being the graft implementation.
So you can drop ‘with-store’ here, and then:
> + (run-with-store store
> + (let ((file-system-type "ext2"))
> + (mlet* %store-monad
> + ((base-image (find-image file-system-type))
> + (sys (lower-object
> + (system-image
> + (image
> + (inherit base-image)
> + (size image-size)
> + (operating-system os)))))
> + (drvs (mapm/accumulate-builds lower-object (list sys)))
> + (% (built-derivations drvs)))
> + (let ((output (derivation->output-path sys)))
> + (return output))))
Mathieu, can we make ‘find-image’ non-monadic? It really shouldn’t be
because it doesn’t interact with the store. It can take an optional
‘system’ parameter if we want.
So, assuming ‘find-image’ is non-monadic, the code above becomes
something like:
(system-image
(image (inherit base-image)
(size image-size)
(operating-system
(with-parameters ((%current-target-system "i586-pc-gnu"))
os))))
> +(define %hurd-in-vm-operating-system
> + (operating-system
> + (inherit %hurd-default-operating-system)
> + (host-name "guixydevel")
> + (timezone "Europe/Amsterdam")
> + (bootloader (bootloader-configuration
> + (bootloader grub-minimal-bootloader)
> + (target "/dev/vda")
> + (timeout 0)))
> + (services (cons*
> + (service openssh-service-type
> + (openssh-configuration
> + (openssh openssh-sans-x)
> + (use-pam? #f)
> + (port-number 2222)
> + (permit-root-login #t)
> + (allow-empty-passwords? #t)
> + (password-authentication? #t)))
> + %base-services/hurd))))
I understand the need to factorize useful configs, but IMO it doesn’t
belong here. So I’d just leave it out. There’s already
‘%hurd-default-operating-system’ that does the heavy lifting anyway.
> +(define hurd-in-vm-service-type
> + (service-type
> + (name 'hurd-in-vm)
> + (extensions (list (service-extension shepherd-root-service-type
> + hurd-in-vm-shepherd-service)))
> + (default-value (hurd-in-vm-configuration))
> + (description
> + "Provide a Virtual Machine running the GNU Hurd.")))
Being pedantic: s|the GNU Hurd|GNU/Hurd|. :-)
Otherwise looks great to me, thank you!
Ludo’.
next prev parent reply other threads:[~2020-06-11 20:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 8:54 [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type' Jan (janneke) Nieuwenhuizen
2020-06-10 11:34 ` Mathieu Othacehe
2020-06-11 19:43 ` Ludovic Courtès
2020-06-11 19:59 ` Jan Nieuwenhuizen
2020-06-11 20:01 ` Marius Bakke
2020-06-12 6:39 ` Jan Nieuwenhuizen
2020-06-12 10:51 ` Diego Nicola Barbato
2020-06-13 7:30 ` Jan Nieuwenhuizen
2020-06-11 19:59 ` Ludovic Courtès [this message]
2020-06-11 21:57 ` Jan Nieuwenhuizen
2020-06-12 6:46 ` Jan Nieuwenhuizen
2020-06-12 14:45 ` Ludovic Courtès
2020-06-12 21:33 ` Jan Nieuwenhuizen
2020-06-12 15:04 ` Mathieu Othacehe
2020-06-12 21:33 ` Jan Nieuwenhuizen
2020-06-14 12:10 ` [bug#41785] [PATCH v4] " Jan Nieuwenhuizen
2020-06-14 12:44 ` Mathieu Othacehe
2020-06-14 13:18 ` Jan Nieuwenhuizen
2020-06-14 15:52 ` Mathieu Othacehe
2020-06-14 16:22 ` Mathieu Othacehe
2020-06-14 16:42 ` bug#41785: " Jan Nieuwenhuizen
2020-06-12 14:42 ` [bug#41785] [PATCH] DRAFT " Mathieu Othacehe
2020-06-12 15:39 ` Ludovic Courtès
2020-06-12 21:42 ` [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic Jan (janneke) Nieuwenhuizen
2020-06-12 21:42 ` [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type' Jan (janneke) Nieuwenhuizen
2020-06-13 12:49 ` Mathieu Othacehe
2020-06-13 13:10 ` Jan Nieuwenhuizen
2020-06-13 14:35 ` Ludovic Courtès
2020-06-13 15:01 ` Mathieu Othacehe
2020-06-13 10:56 ` [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic Mathieu Othacehe
2020-06-13 13:05 ` Jan Nieuwenhuizen
2020-06-14 12:37 ` Mathieu Othacehe
2020-06-14 13:12 ` Jan Nieuwenhuizen
2020-06-14 13:32 ` Jan Nieuwenhuizen
2020-06-14 15:44 ` Mathieu Othacehe
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=87eeql9xvt.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=41785@debbugs.gnu.org \
--cc=janneke@gnu.org \
--cc=othacehe@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).