unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Konrad Hinsen <konrad.hinsen@fastmail.net>
To: Guix Help <help-guix@gnu.org>
Subject: Re: Appropriate way to use Guix API from a Guile program
Date: Tue, 26 May 2020 10:25:35 +0200	[thread overview]
Message-ID: <m17dwzxfuo.fsf@khs-macbook.home> (raw)
In-Reply-To: <CAJ3okZ1_s1j97ubYQFJj6Js=8=7XrnEHqYv1RJgMtapVRCvP_g@mail.gmail.com>

Hi everyone,

zimoun <zimon.toutoune@gmail.com> writes:

>> Thanks for the reminder that my "guix repl" patch needs more work - it
>> should accept command line arguments for the script. Something like
>>
>>    guix repl foo.scm –- [ARGS]
>>
>> should be easily doable, and fits in with existing conventions.
>
> It could be really cool! :-)

Unfortunately, it doesn't look as straightforward as I thought.
A standard Guile script retrieves command line arguments using
(command-line). "guix repl" should ideally manipulate the return
value of (command-line) to make things just work, but I haven't
found a way to do this.

The other solution is to define a command-line interface specifically
for scripts run using "guix repl", which looks like a lot of effort
for a less-than-optimal result.


Alex Sassmannshausen <alex.sassmannshausen@gmail.com> writes:

> I can't help but think that it would be really useful to have a way to
> inject these load paths into the general user environment, in a way
> similar to `guix package --search-paths', so that the currently pulled
> guix can be just another guile library to be used on the system like
> any other.

I don't see any other way to do this than to shell out to "guix", parse
the return value, and modify load-path. Certainly doable, but I am not
sure it's worth the effort.

The problem with Guix is that are so many of it. Most users have a
single Guix version that they update using "guix pull", but others also
use development branches compiled locally and invoked via the preᵢnstₑnv
script. In the end it's the user who picks the right Guix for the job at
the command line. Any Guile script referring to Guix should offer the
same flexibility.

sirgazil <sirgazil@zoho.com> writes:

> And if you wanted to run the script without typing "guix repl", what would be
> the first line of the script. This?
>
> #!~/.config/guix/current/bin/guix repl
> !#

I'd go for 

> #!/bin/env guix repl
> !#

or something like that. I suspect it requires some more incantation
magic to work.

Cheers,
  Konrad


  reply	other threads:[~2020-05-26  8:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 21:38 Appropriate way to use Guix API from a Guile program sirgazil
2020-05-21 12:31 ` Efraim Flashner
2020-05-21 12:44 ` Marius Bakke
2020-05-21 13:25   ` sirgazil
2020-05-21 20:43   ` sirgazil
2020-05-21 20:52     ` Marius Bakke
2020-05-21 22:28       ` sirgazil
2020-05-21 23:02       ` zimoun
2020-05-22  7:43         ` Konrad Hinsen
2020-05-22  8:14           ` zimoun
2020-05-26  8:25             ` Konrad Hinsen [this message]
2020-05-26 16:00               ` Konrad Hinsen
2020-05-22  8:56           ` Alex Sassmannshausen
2020-05-22 14:28           ` sirgazil
2020-05-22 13:52         ` sirgazil

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=m17dwzxfuo.fsf@khs-macbook.home \
    --to=konrad.hinsen@fastmail.net \
    --cc=help-guix@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.
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).