all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Jookia <166291@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] vm: Have qemu-image generate derivations instead.
Date: Tue, 29 Mar 2016 21:46:14 +0200	[thread overview]
Message-ID: <87h9fphxtl.fsf@gnu.org> (raw)
In-Reply-To: <56c321ad.e4f9420a.ee59b.4aa7@mx.google.com> (Jookia's message of "Thu, 11 Feb 2016 11:41:53 +0000")

Jookia <166291@gmail.com> skribis:

> This small refactor should simplify some duplicated effort across functions and
> allow smarter qemu-image to do smarter things based on the operating system
> configuration rather than having each function that uses qemu-image pass
> selective parameters whenever new information is needed.

Damn, it’s been more than a month, please accept my apologies!

Overall this sounds like a good idea.  However…

> * gnu/system/vm.scm (qemu-image): Replace os-derivation, grub-configuration and
>   inputs parameters with os-configuration, base-inputs and extra-inputs.
>   (qemu-image): Based on base-inputs, generate grub.cfg and os-drv.
>   (system-disk-image, system-qemu-image, system-qemu-image/shared-store):
>   Pass in the operating system configuration and base-inputs to qemu-image
>   instead of derivations.

One of the reasons ‘os-drv’ and ‘grub.cfg’ are passed around is that
recomputing them is relatively costly.

There’s a solution to that in 4c2ade20c65e94c41dc8c65db73dd128343a0ad5
(in ‘wip-build-systems-gexp’; it memoizes ‘operating-system-derivation’
and others), so we could almost consider it solved.

Nevertheless it’d be nice to make sure performance remains reasonable
even in the absence of the above commit.

> +                     (base-inputs (list 'grub.cfg 'system))

[...]

> +  (mlet* %store-monad ((os-drv   (operating-system-derivation os-configuration))
> +                       (grub.cfg (operating-system-grub.cfg os-configuration))
> +                       (inputs -> (append
> +                                    (if (member 'grub.cfg base-inputs)
> +                                      `(("grub.cfg" ,grub.cfg)) '())
> +                                    (if (member 'system base-inputs)
> +                                      `(("system" ,os-drv)) '())

Use of “magic” values like 'grub.cfg here is undesirable IMO, because it
introduces singularities in the API, and generally makes the interface
non-obvious.

So I think I’d leave it up to the caller to pass

  #:inputs `(("grub.cfg" ,grub.cfg)) 

Same for "system".

All in all, I sympathize with the desire to avoid passing OS-DRV and
GRUB.CFG around, but I’m not convinced that this approach can improve
the situation.

WDYT?

Thank you!

Ludo’.

  reply	other threads:[~2016-03-29 19:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 11:41 [PATCH] vm: Have qemu-image generate derivations instead Jookia
2016-03-29 19:46 ` Ludovic Courtès [this message]
2016-03-29 23:13   ` Jookia
2016-04-11 22:21     ` Jookia
2016-04-12  0:01       ` Mathieu Lirzin
2016-04-26  9:23       ` Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=87h9fphxtl.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=166291@gmail.com \
    --cc=guix-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.