help-guix
[Top][All Lists]
Advanced

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

Re: Setting up Guile for use with Guix


From: Pierre Neidhardt
Subject: Re: Setting up Guile for use with Guix
Date: Fri, 17 Aug 2018 17:46:03 +0200
User-agent: mu4e 1.0; emacs 26.1

Looks like you've double-sent the message ;)

> Guile does not have a package manager of its own

Actually there is

        https://gitlab.com/a-sassmannshausen/guile-hall/

> Will this install a second Guile for me (one system-wide from
> apt and one for the Guix profile from Guix)?

Yes, Guix is only aware of its own store.  "Functional" means that the
environment (the host system) does not impact the way packages are built and
installed.
Whatever is done on the APT side will not change how Guix performs its 
operations.

> Should I uninstall the Guile from apt?

You can.  If you like Guix better, you can even "apt-remove" everything that is
not strictly necessary to for Kubuntu to start up.

> How do I even set up Guile to work with Guix packages? I don't have any
> installed yet, but when I open a regular Guile REPL and type
>
>     (use-modules (guix gexp))

This is a Guile question.
Check the value of

  %load-path

In my case, it returns

--8<---------------cut here---------------start------------->8---
%load-path
$2 = ("/home/ambrevar/.cache/emacs/elpa/geiser-20180626.1140/scheme/guile/"
"/home/ambrevar/.guix-profile/share/guile/site/2.2"
"/run/current-system/profile/share/guile/site/2.2"
"/gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4/share/guile/2.2"
"/gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4/share/guile/site/2.2"
"/gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4/share/guile/site"
"/gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4/share/guile")
--8<---------------cut here---------------end--------------->8---

"/run/current-system/profile/share/guile/site/2.2" contains guix.scm.

Then from a REPL I can call

  ,use (guix gexp)

I'm not so sure about foreign distros, but if guix.scm is nowhere in the
%load-path, you might have to install the `guix` package:

  $ guix package --install guix

This should put guix.scm in one of the /guile/site folders.

> Am I supposed to create a custom per-project profile, switch
> to that profile while working, and then switch back to normal once done?

This is a possible workflow, but you don't have to.  You can also install the
tools and libraries in the default user profile.

Your question targets more the kind of project (i.e. tool + programming
language) than Guix it self: each tool and programming language has (or should
have) a notion of "search path".  In the case of Guile, it's embodied in the
%load-path variable.

When installing packages, Guix sets environment variables so that the user
profile (~/.guix-profile by default) is added to the search paths of the various
tools.

You can check the environment from the shell:

  $ env

As a rule of thumb, everything should work out-of-the-box with Guix and you
should not have to configure anything extra.  Else it's probably a bug, or you
misconfigured Guix.

> In my case I want to install Haunt. There are two packages: 'haunt' and
> 'guile2.0-haunt', the only difference seems to be which version of Guile they
> require. Right?

Correct.

  $ guix package --show=haunt | recsel -p dependencies

will show you the dependencies.

> To make matters more complicated, Haunt is not just a library,
> but also a stand-alone command-line program, which (I presume) includes its
> own Guile implementation,

The Guile binary is a dependency, it's not embedded into Haunt.

> and so I need to make my own libraries available to
> Haunt's Guile, not the Guile I installed on my system.

I'm not sure I understood your issue.  If you install Haunt, then the required
Guile will be automatically installed into the Guix store.

It's perfectly fine to have 2 Guiles (one from Guix, one from APT) on your
system.

If you call `guile`, it will call the first Guile found in the PATH.  You can
check which one it is with

  $ which guile

You can also force which Guile you want to call:

  $ /usr/bin/guile

The above is Guile from APT.

  $ guix build guile
  /gnu/store/zs259yxkp6chya1nwjhb9saavkz4hpjv-guile-2.2.4-debug
  /gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4
        $ /gnu/store/p9wm67w3rfw3hlb9iljgvsfn84mz4w9d-guile-2.2.4/bin/guile

The above line is Guile from Guix.

For libraries, it does not matter which Guile runs (as long as they are
compatible).  What matters is that the %load-path of the running Guile points to
the library.

For programs (e.g. Haunt), the shabang points to which Guile version is used.
For instance, a Guile script starting with

  #!guile

will get executed with the first Guile found in the PATH.

On my system, Haunt's shabang is the following:

--8<---------------cut here---------------start------------->8---
#!/gnu/store/1mr5izrbxwd7cbq8m1xrqm45rzkibpsj-guile-2.2.3/bin/guile 
--no-auto-compile
-*- scheme -*-
!#
--8<---------------cut here---------------end--------------->8---

Check the Guile reference, this is covered in details in
"(guile) Guile Scripting".

Hope that helps.

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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