* Setting up Guile for use with Guix
@ 2018-08-17 11:39 HiPhish
0 siblings, 0 replies; 6+ messages in thread
From: HiPhish @ 2018-08-17 11:39 UTC (permalink / raw)
To: help-guix
Hello everyone,
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.
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.
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)? Should I uninstall the Guile from
apt?
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.
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? 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?
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 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Setting up Guile for use with Guix
@ 2018-08-17 12:34 HiPhish
2018-08-17 15:46 ` Pierre Neidhardt
2018-08-19 20:41 ` Amirouche Boubekki
0 siblings, 2 replies; 6+ messages in thread
From: HiPhish @ 2018-08-17 12:34 UTC (permalink / raw)
To: help-guix
Hello everyone,
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.
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.
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)? Should I uninstall the Guile from
apt?
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.
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? 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?
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 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up Guile for use with Guix
2018-08-17 12:34 HiPhish
@ 2018-08-17 15:46 ` Pierre Neidhardt
2018-08-18 21:40 ` HiPhish
2018-08-19 20:41 ` Amirouche Boubekki
1 sibling, 1 reply; 6+ messages in thread
From: Pierre Neidhardt @ 2018-08-17 15:46 UTC (permalink / raw)
To: HiPhish; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 5091 bytes --]
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up Guile for use with Guix
2018-08-17 15:46 ` Pierre Neidhardt
@ 2018-08-18 21:40 ` HiPhish
2018-08-24 22:17 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: HiPhish @ 2018-08-18 21:40 UTC (permalink / raw)
To: Pierre Neidhardt; +Cc: help-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.
OK, I have installed Guile from Guix now and it seems to run fine. I did have
to install guile-readline separately though. When I installed Guile through
apt it came with the readline library already included.
> 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.
This is odd: after I installed Guile and Guix none of the directories listed
above existed. However, after installing guile-readline they appeared along
with a bunch of other Guile libraries.
$ ls site/2.2/
bytestructures gnu.scm guix.scm json.scm sqlite3.scm
git gnutls ice-9 run-tests.body.scm ssh
git.scm gnutls.scm json run-tests.guile.scm
gnu guix json.go run-tests.r7.scm
Well, at least I have it working now. Thank you for your help.
> You can. If you like Guix better, you can even "apt-remove" everything that
> is not strictly necessary to for Kubuntu to start up.
Yes, this is the eventual plan. I want to first update the packages I use and
then get rid of the PPAs I have installed (Neovim and Mono). I had watched a
talk about Guix a while ago and how it aims to solve the problem of stateful
package management, and I was instantly sold. I have tried using Flatpak, but
it's really primarily geared towards proprietary software (just look at the
front page of FlatHub). I believe functional package management is the way of
the future, at least for Free Software.
> Looks like you've double-sent the message ;)
Yeah, sorry about that, I have switched to a new email provider, the first
message did not show up in my "sent" directory, so I thought it got lost.
> Actually there is
>
> https://gitlab.com/a-sassmannshausen/guile-hall/
From the description it sounds like hall is a project generator, not something
to install other libraries with :/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up Guile for use with Guix
2018-08-17 12:34 HiPhish
2018-08-17 15:46 ` Pierre Neidhardt
@ 2018-08-19 20:41 ` Amirouche Boubekki
1 sibling, 0 replies; 6+ messages in thread
From: Amirouche Boubekki @ 2018-08-19 20:41 UTC (permalink / raw)
To: HiPhish; +Cc: help-guix, Help-Guix
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-24 22:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 11:39 Setting up Guile for use with Guix HiPhish
-- strict thread matches above, loose matches on Subject: below --
2018-08-17 12:34 HiPhish
2018-08-17 15:46 ` Pierre Neidhardt
2018-08-18 21:40 ` HiPhish
2018-08-24 22:17 ` Ludovic Courtès
2018-08-19 20:41 ` Amirouche Boubekki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).