* Setting up a geiser development environment
@ 2022-05-08 18:22 Einar Largenius
2022-05-28 3:16 ` Fredrik Salomonsson
2022-05-28 17:31 ` Tobias Geerinckx-Rice
0 siblings, 2 replies; 6+ messages in thread
From: Einar Largenius @ 2022-05-08 18:22 UTC (permalink / raw)
To: Guix mailing list
Hello!
I am trying to learn using guix and I think having access to a usable
repl would be helpful.
I have installed geiser to use with guix. I use the ELPA version of
geiser. I installed guix on a foreign distro with the installation
script found on the website.
What do I need to do to make guix symbols available for use with a REPL?
For example, I open a scheme file in Emacs and start geiser, but when I
evaluate for example:
(specifications->manifest
(list "guile"))
It says specifications->manifest is unbound.
--
With kind regards Einar
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up a geiser development environment
2022-05-08 18:22 Setting up a geiser development environment Einar Largenius
@ 2022-05-28 3:16 ` Fredrik Salomonsson
2022-05-31 18:26 ` Einar Largenius
2022-05-28 17:31 ` Tobias Geerinckx-Rice
1 sibling, 1 reply; 6+ messages in thread
From: Fredrik Salomonsson @ 2022-05-28 3:16 UTC (permalink / raw)
To: Einar Largenius, Guix mailing list
Hi,
Einar Largenius <jaadu@lysator.liu.se> writes:
> Hello!
>
> I am trying to learn using guix and I think having access to a usable
> repl would be helpful.
>
> I have installed geiser to use with guix. I use the ELPA version of
> geiser. I installed guix on a foreign distro with the installation
> script found on the website.
>
> What do I need to do to make guix symbols available for use with a REPL?
>
> For example, I open a scheme file in Emacs and start geiser, but when I
> evaluate for example:
>
> (specifications->manifest
> (list "guile"))
>
> It says specifications->manifest is unbound.
>
You need to have guix in the %load-path variable, then load the module
containing `specifications->manifest`. The easiest way is to just run
guix repl
from a terminal (or shell in emacs) to get a repl.
Or if you want to use geiser you can use guix shell to setup the right
environment and launch emacs
guix shell guix guile --emacs
Once you got the correct load path setup you can just import the module
containing `specifications->manifest` in the repl.
(use-modules (gnu packages))
To find which module that contain that procedure, you can search for it
in the guix manual and it will say just above it what module it
contains.
Alternative you can clone the guix repo and call something like
consult-ripgrep in emacs on it with the search term
#specifications->manifest#define
The guix manual will also describe how to setup emacs for hacking on
guix [0] that might be useful.
[0] https://guix.gnu.org/manual/en/html_node/The-Perfect-Setup.html
I hope that helps.
--
s/Fred[re]+i[ck]+/Fredrik/g
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up a geiser development environment
2022-05-28 3:16 ` Fredrik Salomonsson
@ 2022-05-31 18:26 ` Einar Largenius
2022-06-01 19:02 ` Fredrik Salomonsson
0 siblings, 1 reply; 6+ messages in thread
From: Einar Largenius @ 2022-05-31 18:26 UTC (permalink / raw)
To: Fredrik Salomonsson; +Cc: Guix mailing list
Hi, thanks for the reply.
I want to have geiser accessible. It would make trailing and error and
finding symbols much easier.
> (use-modules (gnu packages))
I forgot to include this in my example. The Geiser repl tells me there are
no code for the module. It works fine when using guix repl though.
I checked the value of %load-path when I start geiser and compare it
with the value I get with guix repl. They look very similar except the
load path provided with guix repl is provides an additional path:
"/gnu/store/6qfk8gs9qyk5vx79bb62gf4gz9n7wp95-guix-module-union/share/guile/site/3.0"
I don't find anything similar in my .guix-profile.
I see a few alternatives.
1. Identify which package includes this "guix-module-union" and add it
to my profile.
2. Dynamically add the path using wildcards to my .guile startup file.
Adding a hardcoded path will break this during every update.
3. Change so that geiser uses "guix repl" instead of "guile" when
starting a repl.
I lack the experience with both guix and scheme so none of the above
would be easy to do for me. The last alternative would probably be the
easiest for me.
--
Med vänliga hälsningar Einar
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up a geiser development environment
2022-05-31 18:26 ` Einar Largenius
@ 2022-06-01 19:02 ` Fredrik Salomonsson
0 siblings, 0 replies; 6+ messages in thread
From: Fredrik Salomonsson @ 2022-06-01 19:02 UTC (permalink / raw)
To: Einar Largenius; +Cc: Guix mailing list
Hej,
Einar Largenius <jaadu@lysator.liu.se> writes:
> Hi, thanks for the reply.
>
> I want to have geiser accessible. It would make trailing and error and
> finding symbols much easier.
>
>> (use-modules (gnu packages))
>
> I forgot to include this in my example. The Geiser repl tells me there are
> no code for the module. It works fine when using guix repl though.
>
> I checked the value of %load-path when I start geiser and compare it
> with the value I get with guix repl. They look very similar except the
> load path provided with guix repl is provides an additional path:
>
> "/gnu/store/6qfk8gs9qyk5vx79bb62gf4gz9n7wp95-guix-module-union/share/guile/site/3.0"
>
> I don't find anything similar in my .guix-profile.
Yeah, it is the same on my machine. I'm using guix on a foreign distro.
I poked around with this a bit yesterday but couldn't find a satisfying
solution. But my solution for #2 came quite close.
>
> I see a few alternatives.
>
> 1. Identify which package includes this "guix-module-union" and add it
> to my profile.
The one that includes that is guix itself. And that is stamped into the
guix commandline tool.
See:
cat `which guix`
Or guix/self.scm:581 and guix/self.scm:515 in the source code.
Closest you get is adding guix to a temporary profile like
guix shell guix guile
I would not recommend adding guix to your .guix-profile, as that messes
up quite a few things. The guix you install is not neccessary the guix
you are running. It gets really meta when you install your package
manager with your package manager :). So I would recommend using
`guix shell` for that.
> 2. Dynamically add the path using wildcards to my .guile startup file.
> Adding a hardcoded path will break this during every update.
This will not break during every update, but highly likely to break when
you run `guix gc`. As it is then paths are deleted in the store.
Best I came up with is to first export the development environment of
guix using:
guix shell guile --development guix --export-manifest
This will give you something that looks like this:
---8<---------------------------------------------------------------------------
;; What follows is a "manifest" equivalent to the command line you gave.
;; You can store it in a file that you may then pass to any 'guix' command
;; that accepts a '--manifest' (or '-m') option.
(concatenate-manifests
(list (specifications->manifest (list "guile"))
(package->development-manifest
(specification->package "guix"))))
--------------------------------------------------------------------------->8---
Then add your current guix's guile paths to the guile environment
variables (assuming you have bash or something equivalent):
---8<---------------------------------------------------------------------------
export GUILE_LOAD_PATH=$HOME/.config/guix/current/share/guile/site/3.0:$GUILE_LOAD_PATH
export GUILE_LOAD_COMPILED_PATH=$HOME/.config/guix/current/lib/guile/3.0/site-ccache:$GUILE_LOAD_COMPILED_PATH
--------------------------------------------------------------------------->8---
Just adding the current guix's guile paths to guile will not include the
dependencies guix needs. E.g. you'll see error messages like these `no
code for module (gcrypt hash)` when trying to use (gnu packages).
This is what `--development guix` in guix shell or
`(package->development-manifest (specification->package "guix"))` in the
manifest do. I.e. it will specify the development environment for guix.
Then you can either use `guix shell -m <manifest>` to setup the package
environment or `guix package -m <manifest>` to install the packages to
your .guix-profile. Note that `guix package -m <manifest>` will remove
all packages installed to the profile that are not listed in the
manifest. So do a `guix package --export-manifest` first and combine
that with the manifest above.
An alternative to the autogenerated manifest from `guix shell`, is to
simply fetch the propagated-inputs from the guix package and add that to
the manifest:
---8<---------------------------------------------------------------------------
(use-modules
(guix packages) ;; For package-propagated-inputs
(gnu packages) ;; For specifications->manifest
(gnu packages package-management)) ;; Access to the guix package
(specifications->manifest
`(
"guile"
,@(map car (package-propagated-inputs guix))
))
--------------------------------------------------------------------------->8---
The (map car …) is to just return the name of each propagated-input of
the guix package. As for the `(…) and ,@ see the quasiquote section in
the guile manual[0].
[0] https://www.gnu.org/software/guile/manual/html_node/Expression-Syntax.html
> 3. Change so that geiser uses "guix repl" instead of "guile" when
> starting a repl.
>
I quickly tested this by setting `geiser-guile-binary` to "guix repl".
But it expects a name to a binary and not a binary with arguments. It is
probably doable but would require more hacking to get this to work.
> I lack the experience with both guix and scheme so none of the above
> would be easy to do for me. The last alternative would probably be the
> easiest for me.
>
I would say try my suggestion for #2. But if you just want to quickly
get going with playing around with the repl. Use:
guix shell guix guile -- emacs
A caveat with the guix shell command is that the guix you get is most
likely not the same guix you are running outside of the guix shell
environment.
And I'm far from an expert in either guix or guile so there are probably
better ways to set this up.
--
s/Fred[re]+i[ck]+/Fredrik/g
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting up a geiser development environment
2022-05-08 18:22 Setting up a geiser development environment Einar Largenius
2022-05-28 3:16 ` Fredrik Salomonsson
@ 2022-05-28 17:31 ` Tobias Geerinckx-Rice
2022-05-28 18:02 ` Tobias Geerinckx-Rice
1 sibling, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2022-05-28 17:31 UTC (permalink / raw)
To: Einar Largenius; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 624 bytes --]
Hi Einar,
Disclaimer: I'm not a Geiser guru, but I don't think it relieves
you of importing modules?
When I run M-x geiser followed by a
(use-modules (gnu packages))
then specifications->manifest does the needful.
If that still doesn't work for you, it might be that
GUILE_LOAD_PATH isn't automatically set up on foreign distros. On
my Guix System it set to
"/run/current-system/profile/share/guile/site/3.0" (which won't
exist for you).
Perhaps setting it to your
"$HOME/.guix-profile/share/guile/site/3.0" will work, or perhaps
it will break something else…
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-06-01 19:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-08 18:22 Setting up a geiser development environment Einar Largenius
2022-05-28 3:16 ` Fredrik Salomonsson
2022-05-31 18:26 ` Einar Largenius
2022-06-01 19:02 ` Fredrik Salomonsson
2022-05-28 17:31 ` Tobias Geerinckx-Rice
2022-05-28 18:02 ` Tobias Geerinckx-Rice
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).