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: Amirouche Boubekki
Subject: Re: Setting up Guile for use with Guix
Date: Sun, 19 Aug 2018 22:41:30 +0200
User-agent: Roundcube Webmail/1.1.2

On 2018-08-17 14:34, HiPhish wrote:
Hello everyone,


Hello HiPhish,


I am a regular Ubuntu, guix user and I develop stuff using guile.


I have Guix up and running on my Kubuntu 18.04 machine. I installed it
manually
from the binary: I first installed Guile 2.2.3 via apt, then I installed Guix.

Wow! ubuntu has a quiet recent guile! that's good news!

What matters when installing guix package manager on top another distribution is only the shell and PID 1. If you use zsh or something fancy as shell, you might need to adapt some of the instructions from the manual. If you don't rely on systemd or upstart again, you will need to adapt the direction given in the manual which can boil down to run guix-daemon as root in the background in a screen. Poor man's service,
I know, but it works.

Another thing that might matter is some kernel options, but that is only relevant if you use guix containers. I did not try guix containers for a looooong time,
so it might work out of the box with recent kernels.

Since I am a using both bash and systemd I just follow the instructions from
the manual I have nothing specific to do.

The only thing I struggle with is the shell environment variables. That is
what outputs the following command as a regular user:

  guix package --search-paths

I just reinstalled ubuntu and guix from binary and I have setup my guile dev environment to run and develop my guile project. Here is the output of the above
command:

----->8------ START ----->8----------->8----------->8----------->8----------->8----------->8------

export PATH="/home/amirouche/.guix-profile/bin:/home/amirouche/.guix-profile/sbin" export GUILE_LOAD_PATH="/home/amirouche/.guix-profile/share/guile/site/2.2" export GUILE_LOAD_COMPILED_PATH="/home/amirouche/.guix-profile/lib/guile/2.2/site-ccache:/home/amirouche/.guix-profile/share/guile/site/2.2"
export XDG_DATA_DIRS="/home/amirouche/.guix-profile/share"
export GIO_EXTRA_MODULES="/home/amirouche/.guix-profile/lib/gio/modules"
export GIT_SSL_CAINFO="/home/amirouche/.guix-profile/etc/ssl/certs/ca-certificates.crt"
export GIT_EXEC_PATH="/home/amirouche/.guix-profile/libexec/git-core"
export PKG_CONFIG_PATH="/home/amirouche/.guix-profile/lib/pkgconfig:/home/amirouche/.guix-profile/share/pkgconfig"
export SSL_CERT_DIR="/home/amirouche/.guix-profile/etc/ssl/certs"

----->8------ END ----->8----------->8----------->8----------->8----------->8----------->8------

That is actually the content of ~/.bash_profile file

I added an export EDITOR=emacs because emacs is my editor of choice. For some reason, I always need to source ~/.bash_profile when I want to use guix in a new shell.

I wanted to do some more serious Guile work involving libraries, and since Guile does not have a package manager of its own, using Guix is the way to go.

If you try guile-hall, don't forget to send us feedback, please :)

Here is my question: how do I properly set up Guile on Guix? I already have Guile set up system-wide (via apt), but packages like Haunt list Guile as
their
own dependency. Will this install a second Guile for me (one system-wide from
apt and one for the Guix profile from Guix)?

It depends on how haunt package definition is written. Because of how guix works, you can use a program that uses guile without having 'guile' command available. Similarly, it makes it possible to run two programs at the same time that depends on different versions of the same library.. that's something that is very difficult to do outside guix and nix. It's one of the consequences of packaging is done. This leads to the point that in theory, you SHOULD never install _libraries_ in your user profile ie. the regular / default profile because no executable will use it. Default guix profile, SHOULD, I THINK, only contain data
and executables.

I say SHOULD everywhere because that's not the way *I* work. Indeed, I install libraries in the user profile instead of relying on guix environment see [0]. Because I find guix environment not good enough for my use case. But I did not come around understanding/explaining what the problem is. (The issue, I have, is that I only know how to use environment with a guix.scm package definition or manifest. I don't like that way. I prefer to have a directory with my profile next to my project and then do a bunch of 'guix package -i guile-wiredtiger'. It's prolly possible
but I never did it)

[0] https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-environment.html

Don't skip environment because of me. I actually use environments when I need to hack on guix itself (because the guix.scm file, aka. the file that setups the environment
profile, is already written...)

Should I uninstall the Guile from apt?

You can and you SHOULD. To avoid any misunderstandings.


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))

I get an error that the '(guix gexp)' module could not be found. So obviously I need to set up Guile first before I can use it to script Guix. I assume the
same is true for other Guile libraries.

That is not a good example use of hacking on a guile project because guix is using it's own version of guile which might be different from the version of guile you installed in your profile... again because functional packaging. If you want to hack on guix follow the README that you can find in guix git repository at [1]

[1] git clone https://git.savannah.gnu.org/git/guix.git

Speaking of which, if there are two libraries, and each one lists a different version of Guile as its dependency, will it be possible to use both libraries
in the same project?

In the case of guile you can not do that. Different executables (with different package definitions) can use different version of guile. That being said two executables coming from the same package get the same guile version and the same libguile. That is a feature that COULD be implemented in Guile VM but is not. It's AFAIK very rare that a VM can handle multiple versions of the same library in the same executable... The only case I know
is JavaScript... try to search://guix+npmjs here be dragons.

I don't quite understand the concepts of functional
package management yet. How do I need to set up my environment for working
with
libraries? Am I supposed to create a custom per-project profile, switch to
that
profile while working, and then switch back to normal once done?

Hey seems like the above rambling was not entirely necessary. Like I said, I don't use profile to hack on my guile projects and install things like guile-wiredtiger in my default profile, but if you know your way around guix profiles you can work that
way too. It is a recommended practice ;]


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? 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, and so I need to make my own libraries available to
Haunt's Guile, not the Guile I installed on my system.

I don't use haunt myself. Lookup the README of the guix website, there is an example of how to setup an environment for building a haunt weblog using
an environment https://git.savannah.gnu.org/cgit/guix/guix-artwork.git/

I just need to wrap my head around the functional way of package management, instead of the classical "lol, just throw everything into the global state"
system. Thank you in advance for your responses.

That's basically what I still do because I don't fully know my guix-fu on guix profiles. I am sure you can do better! The silver lining is that I am living proof
that you don't need to know all of guix to guix.

--
Amirouche ~ amz3 ~ http://www.hyperdev.fr



reply via email to

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