help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appropriate way to use Guix API from a Guile program


From: Konrad Hinsen
Subject: Re: Appropriate way to use Guix API from a Guile program
Date: Tue, 26 May 2020 10:25:35 +0200

Hi everyone,

zimoun <address@hidden> 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 <address@hidden> 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 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]