Subject: bug#44612: Read standard input in `guix repl'

From: Pierre Neidhardt <[email-masked]>
Date: Mon, 16 Nov 2020 12:36:02 +0100

Ludovic Courtès <[email-masked]> writes:

> Hi,
>
> Bengt Richter <[email-masked]> skribis:
>
>> On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
>>> `guix repl` is a fantastic, hassle-free tool to bind Guix with
>>> third-party languages.  I've done it here:
>>> 
>>> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp
>
> I recommend using ‘guix repl -t machine’

Looks like `-t machine` has the same issue.
This does what I want:

--8<---------------cut here---------------start------------->8---
$ echo "(display \"Hi.\\n\")" | guix repl -t machine /dev/stdin
Hi.
--8<---------------cut here---------------end--------------->8---

This does not:

--8<---------------cut here---------------start------------->8---
$ echo "(display \"Hi.\\n\")" | guix repl -t machine  
(repl-version 0 1 1)
Hi.
(values (non-self-quoting 2052 "#<unspecified>"))
--8<---------------cut here---------------end--------------->8---

> and keeping the REPL process around instead of respawning it for every
> expression.

At first glance, we would want to do this indeed.

But in the case of Nyxt, there would be no point when to terminate the
process, so it would be around for the whole time Nyxt is running, which
may not be desirable.

Alternatively, I could simply keep it alive for a given duration (1
minute?) and automatically spawn it if the process is dead.

Any recommendations?

-- 
Pierre Neidhardt
https://ambrevar.xyz/