mbox

[bug#36162,0/4] Add 'remote-eval'

Message ID 20190610210853.5709-1-ludo@gnu.org
Headers show

Message

Ludovic Courtès June 10, 2019, 9:08 p.m. UTC
Hello Guix!

This patch series add ‘remote-eval’, which takes a gexp, remotely deploys
everything the gexp refers to, and evaluates it (see
<https://lists.gnu.org/archive/html/guix-devel/2019-03/msg00127.html> for
the initial discussion.)  So you can have gexps like:

  #~(execl #$(file-append ffmpeg "/bin/ffmpeg") …)

When you evaluate it, this specific ‘ffmpeg’ will be deployed over there.
Another example is:

  (with-imported-modules (source-module-closure '((gnu services herd)))
    #~(begin
        (use-modules (gnu services herd))
        (map live-service-provision (current-services))))

This gexp, when evaluated remotely, will use your very own (gnu services
herd) module and the corresponding Guile (so if you’re on Guile 3 and the
remote is still on Guile 2, that’s fine: Guile 3 will first be deployed
there.)

‘remote-eval’ allows you to build locally and send the build results,
or to send the derivations and build remotely.

The use case is for code that deals with state or has a side effect.
Otherwise you’d just use a derivation and offload it.

There are no tests for ‘remote-eval’ currently.  It would need a VM
with access to the store, as Jakob explained on guix-devel.

Thoughts?

Ludo’.

Ludovic Courtès (4):
  gexp: Add 'lower-gexp' and express 'gexp->derivation' in terms of it.
  Add (guix repl).
  inferior: Add 'read-repl-response'.
  Add (guix remote).

 Makefile.am           |   2 +
 guix/gexp.scm         | 238 +++++++++++++++++++++++++++++++-----------
 guix/inferior.scm     |   9 +-
 guix/remote.scm       | 130 +++++++++++++++++++++++
 guix/repl.scm         |  86 +++++++++++++++
 guix/scripts/repl.scm |  56 +---------
 tests/gexp.scm        |  37 +++++++
 7 files changed, 444 insertions(+), 114 deletions(-)
 create mode 100644 guix/remote.scm
 create mode 100644 guix/repl.scm

Comments

Ricardo Wurmus June 11, 2019, 1:26 p.m. UTC | #1
Ludovic Courtès <ludo@gnu.org> writes:

> This patch series add ‘remote-eval’, which takes a gexp, remotely deploys
> everything the gexp refers to, and evaluates it (see
> <https://lists.gnu.org/archive/html/guix-devel/2019-03/msg00127.html> for
> the initial discussion.)  So you can have gexps like:
>
>   #~(execl #$(file-append ffmpeg "/bin/ffmpeg") …)
>
> When you evaluate it, this specific ‘ffmpeg’ will be deployed over there.
> Another example is:
>
>   (with-imported-modules (source-module-closure '((gnu services herd)))
>     #~(begin
>         (use-modules (gnu services herd))
>         (map live-service-provision (current-services))))

> This gexp, when evaluated remotely, will use your very own (gnu services
> herd) module and the corresponding Guile (so if you’re on Guile 3 and the
> remote is still on Guile 2, that’s fine: Guile 3 will first be deployed
> there.)
>
> ‘remote-eval’ allows you to build locally and send the build results,
> or to send the derivations and build remotely.

This is great and just what I need for the install-berlin.scm script in
the “maintenance” repository where I need to deploy a particular version
of Guix to the target system before using that version of Guix to
reconfigure the remote system.

Thank you!

--
Ricardo
Jakob L. Kreuze June 11, 2019, 5:35 p.m. UTC | #2
zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) writes:

> Wow, this is great! It seems like this patch series is implementing a
> number of things I'd been wishing I could just import from some other
> Guix module. I'm signing off for the night, but I'll apply this tomorrow
> and give you some feedback.

It seems this breaks 'operating-system-derivation'.

#+BEGIN_SRC
Backtrace:
          19 (_ #<procedure 40d32e0 at ice-9/eval.scm:330:13 ()> #<…> …)
In gnu/services.scm:
    320:2 18 (_ _)
In gnu/system.scm:
    461:4 17 (_ _)
In unknown file:
          16 (_ #<procedure 40d9220 at ice-9/eval.scm:330:13 ()> #<…> …)
          15 (_ #<procedure 2ebc160 at ice-9/eval.scm:330:13 ()> #<…> …)
In guix/monads.scm:
    482:9 14 (_ _)
In unknown file:
          13 (_ #<procedure 2ebc100 at ice-9/eval.scm:330:13 ()> #<…> …)
In guix/store.scm:
   1667:8 12 (_ _)
   1667:8 11 (_ _)
In unknown file:
          10 (_ #<procedure 2f1d940 at ice-9/eval.scm:330:13 ()> #<…> …)
           9 (_ #<procedure 2f2c460 at ice-9/eval.scm:330:13 ()> #<…> …)
In guix/monads.scm:
    482:9  8 (_ _)
In unknown file:
           7 (_ #<procedure 26ba500 at ice-9/eval.scm:330:13 ()> #<…> …)
In guix/store.scm:
   1667:8  6 (_ _)
In unknown file:
           5 (_ #<procedure 2701740 at ice-9/eval.scm:330:13 ()> #<…> …)
           4 (_ #<procedure 27b2200 at ice-9/eval.scm:330:13 ()> #<…> …)
In ice-9/eval.scm:
   191:27  3 (_ #(#(#<directory (guix gexp) c8f640> #<procedure…>) …))
   173:47  2 (_ #(#(#<directory (guix gexp) c8f640> "module-im…" …) …))
    159:9  1 (_ #(#(#<directory (guix gexp) c8f640> "module-im…" …) …))
In guix/derivations.scm:
   597:28  0 (derivation->output-path #f _)

guix/derivations.scm:597:28: In procedure derivation->output-path:
In procedure struct_vtable: Wrong type argument in position 1 (expecting struct): #f
building gnu-deployed...
#+END_SRC

'git bisect' seems to think that 9dddee345b introduced it.

Regards,
Jakob