[Top][All Lists]

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

Re: Scripting guix in guile

From: Jesse Gibbons
Subject: Re: Scripting guix in guile
Date: Sat, 31 Aug 2019 11:38:03 -0600

On Sat, 2019-08-31 at 19:03 +0200, Konrad Hinsen wrote:
> Hi everyone,
> I'd like to write Guile scripts that inspect Guix, for example
> analyze
> the packages is my profile. That turned out to be a lot more
> difficult
> than I expected, and in fact I haven't found a satisfying general
> solution yet, meaning a script that I could publish in such a way
> that
> any Guix user could download and run it without modification.
> The problems I see are
>  1. What to put into the #! line to locate Guile.
I don't think you need a shebang to script guile. If you do, you could
always make a guix package for the scripts, and that will fix
everything in the patch-shebangs phase.
>  2. How to construct the load path to make sure it includes
>     Guix as installed under $HOME/.config/guix/current
I think the default GUILE_LOAD_PATH includes guix. Here's the contents
of mine:
bytestructures  git.scm  gnutls      guix.scm  json.scm  shepherd.scm
gcrypt          gnu      gnutls.scm  ice-9/    mcron     sqlite3.scm
git             gnu.scm  guix        json      shepherd  ssh

gnu/, gnu.scm, guix/, and guix.scm are all guix, and guix is not part
of my current profile. Note also most of these are prerequisites for
> I wonder if could somehow hijack 'guix repl', which solves these
> problems for a REPL but not for scripts.
> Any ideas?
> Konrad
-You're writing tools for a package manager... try packaging those
tools for the package manager. It will take care of them like it takes
care of everything else. 
--You can wrap the executables with the environment variables you need
so the executable scripts are callable from the default PATH. See what
guix does with guile, mcron, and shepherd, which are mostly guile
scripts with a little bit of native code.

reply via email to

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