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: zimoun
Subject: Re: Appropriate way to use Guix API from a Guile program
Date: Fri, 22 May 2020 01:02:29 +0200

Dear sirgazil,

On Thu, 21 May 2020 at 22:53, Marius Bakke <address@hidden> wrote:
> sirgazil <address@hidden> writes:

> > Hmm, and is there any way for a Guile program installed as a Guix package 
> > to use the modules of the Guix obtained by the user with "guix pull" and 
> > also being able to take advantage of user-defined channels? Or is this just 
> > not possible at all?
>
> You need to add $HOME/.config/guix/current/share/guile/site/3.0 on
> GUILE_LOAD_PATH to access channel code from Guile programs.

If you feel in an experimental mood, you can try the Konrad's patch
[1].  It sets up the PATH accordingly and hides all the internals.
Well, "guix repl" launches a REPL with the current Guix modules
available and the patch extends that to scripts: "guix repl foo.scm".
Note that '--load-path' is supported so you can extend by your own
modules too.  Last, command-line arguments passed to the scripts are
not supported (yet).

Well, if it is a script without command-line argument, then "guix repl
foo.scm" is the thing that you would want, I guess.
If it is a script with command-line argument, then extend
"GUILE_LOAD_PATH" by '~/.config/guix/current/share/guile/site/3.0' and
run "guile foo.scm arg1 arg2" is the thing that you would want, I
guess.

Be careful to not mix the modules from the package named 'guix' --
modules installed with "guix install guix" -- and the modules of the
current Guix -- modules under
~/.config/guix/current/share/guile/site/3.0.  I did the mistake once.
:-)

[1] http://issues.guix.gnu.org/41253


Hope that helps,
simon



reply via email to

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