unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Loading Common Lisp Libraries with GNU/Guix in a REPL
@ 2021-12-10 10:44 jgart
  2021-12-10 10:54 ` jgart
  0 siblings, 1 reply; 5+ messages in thread
From: jgart @ 2021-12-10 10:44 UTC (permalink / raw)
  To: Guix Help

Hi Guixers/Lispers,

What is the recommended way to load common lisp libraries that I install
with GNU/Guix on a foreign distro from a repl?

What are the common practices/workflows that the Guix community currently
uses with emacs-slime or sly to load common lisp libraries?

Is there a way of loading my dependencies with Guix the way they can be loaded 
automatically via quicklisp?

I've tried this so far:

```
$ guix shell sbcl sbcl-dexador rlwrap

$ rlwrap sbcl

CL-USER(1): (asdf:load-system :dexador)
WARNING: System definition file
#P"/gnu/store/zwkhqlyijf8bwpm3a70f7ly978w2knqw-sbcl-flexi-streams-1.0.19/share/common-lisp/sbcl/flexi-streams/flexi-streams.asd"
contains definition for system "flexi-streams-test". Please
only define "flexi-streams" and secondary
systems with a name starting with "flexi-streams/"
(e.g. "flexi-streams/test") in that file.  WARNING: System definition file
#P"/gnu/store/98czgrz2fqq2mjzj80i19yly0n6lw2bs-sbcl-trivial-garbage-0.21/share/common-lisp/sbcl/trivial-garbage/trivial-garbage.asd"
contains definition for system "trivial-garbage-tests". Please only
define "trivial-garbage" and secondary systems with a name starting with
"trivial-garbage/" (e.g. "trivial-garbage/test") in that file.

T
CL-USER(2): (dex:get "http://genenetwork.org/api/v_pre1/species")

"[{\"FullName\":\"Mus
musculus\",\"Id\":1,\"Name\":\"mouse\",\"TaxonomyId\":10090},{\"FullName\":\"Rattus
norvegicus\",\"Id\":2,\"Name\":\"rat\",\"TaxonomyId\":10116},{\"FullName\":\"Arabidopsis
thaliana\",\"Id\":3,\"Name\":\"arabidopsis\",\"TaxonomyId\":3702},{\"FullName\":\"Homo
sapiens\",\"Id\":4,\"Name\":\"human\",\"TaxonomyId\":9606},{\"FullName\":\"Hordeum
vulgare\",\"Id\":5,\"Name\":\"barley\",\"TaxonomyId\":4513},{\"FullName\":\"Drosophila
melanogaster\",\"Id\":6,\"Name\":\"drosophila\",\"TaxonomyId\":7227},{\"FullName\":\"Macaca
mulatta\",\"Id\":7,\"Name\":\"macaque
monkey\",\"TaxonomyId\":9544},{\"FullName\":\"Glycine
max\",\"Id\":8,\"Name\":\"soybean\",\"TaxonomyId\":3847},{\"FullName\":\"Solanum
lycopersicum\",\"Id\":9,\"Name\":\"tomato\",\"TaxonomyId\":4081},{\"FullName\":\"Populus
trichocarpa\",\"Id\":10,\"Name\":\"poplar\",\"TaxonomyId\":3689},{\"FullName\":\"Oryzias
latipes (Japanese medaka)\",\"Id\":11,\"Name\":\"Oryzias
latipes\",\"TaxonomyId\":8090}]
"
200
#<HASH-TABLE :TEST EQUAL :COUNT 6 {1006CDF443}>
#<QURI.URI.HTTP:URI-HTTP http://genenetwork.org/api/v_pre1/species>
#<SB-SYS:FD-STREAM for "socket 192.168.1.198:55100, peer: 128.169.5.59:80" {100697A9A3}>
```

`(asdf:load-system :dexador)` feels a bit verbose for loading a library
at a REPL.

Any help on best practices for common lisp workflows using GNU/Guix is
much appreciated.

all best,

jgart


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Loading Common Lisp Libraries with GNU/Guix in a REPL
  2021-12-10 10:44 Loading Common Lisp Libraries with GNU/Guix in a REPL jgart
@ 2021-12-10 10:54 ` jgart
  2021-12-10 15:03   ` Edouard Klein
  0 siblings, 1 reply; 5+ messages in thread
From: jgart @ 2021-12-10 10:54 UTC (permalink / raw)
  To: Guix Help

On Fri, 10 Dec 2021 05:44:58 -0500 jgart <jgart@dismail.de> wrote:

Alternatively, I was able to also load code this way also after running
the following:

```
$ guix shell sbcl sbcl-cl-str rlwrap

CL-USER(2):
jgart@gac ~ [env] λ rlwrap sbcl
This is SBCL 2.1.9, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
CL-USER(1): (asdf:make "str") 
WARNING: System definition file
#P"/gnu/store/aljfy13phr526w0iqmqz0cf2cnxkjxlb-sbcl-cl-ppcre-unicode-2.1.1/share/common-lisp/sbcl/cl-ppcre-unicode/cl-ppcre-unicode.asd"
contains definition for system "cl-ppcre-unicode-test". Please only
define "cl-ppcre-unicode" and secondary systems with a name starting with
"cl-ppcre-unicode/" (e.g. "cl-ppcre-unicode/test") in that file.

;;; Computing Hangul syllable names
T
CL-USER(2): (in-package :str)

#<PACKAGE "STR">
STR(3): (trim "  rst  ")

"rst"
STR(4): (join " " '("foo" "bar" "baz"))

"foo bar baz"
STR(5): (concat "f" "o" "o")

"foo"
STR(6): (split "+" "foo++bar")

("foo" "" "bar")
```


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Loading Common Lisp Libraries with GNU/Guix in a REPL
  2021-12-10 10:54 ` jgart
@ 2021-12-10 15:03   ` Edouard Klein
  2021-12-12 17:01     ` Katherine Cox-Buday
  0 siblings, 1 reply; 5+ messages in thread
From: Edouard Klein @ 2021-12-10 15:03 UTC (permalink / raw)
  To: jgart; +Cc: help-guix

Hi !

I don't know the "correct" way to do it, but the way I do things is:

Create a manifest.scm or guix.scm file in the directory. Here is an
example manifest.scm file:

#+begin_src scheme
(define-module (osef)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (guix profiles)
  #:use-module (gnu packages lisp)
  #:use-module (gnu packages lisp-xyz)
  #:use-module (gnu packages readline)
  )


(packages->manifest
 (list sbcl sbcl-numcl rlwrap))
#+end_src

Then I run guix shell, which will automatically load this manifest.scm
file.

Then, same as you, I run rlwrap sbcl.

Finally I invoke the following in sbcl:

#+begin_src lisp
    (load "~/.emacs.d/elpa/27.2/develop/slime-20211021.507/swank-loader.lisp")  ;; Found using find .emacs.d/ -iname '*swank*'
    (swank-loader:init)
    (swank:create-server)
#+end_src

This allows my emacs instance, which lives outside the guix shell, to
communicate with the sbcl instance which lives inside. I don't want to
pollute each project with my emacs config, which is done once and for
all for all projects.

To connect: M-x slime-connet, enter, enter.

Then I just (require :numcl) (for example). I did not need to use asdf,
although this may be package-specific. I remember being unable to load a
package once, but I don't rememder which or why (sorry).

So basically, the same as you already do.

If there is a more canonical way, I'd be happy to know :)


Cheers,

Edouard.



jgart <jgart@dismail.de> writes:

> On Fri, 10 Dec 2021 05:44:58 -0500 jgart <jgart@dismail.de> wrote:
>
> Alternatively, I was able to also load code this way also after running
> the following:
>
> ```
> $ guix shell sbcl sbcl-cl-str rlwrap
>
> CL-USER(2):
> jgart@gac ~ [env] λ rlwrap sbcl
> This is SBCL 2.1.9, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses.  See the CREDITS and COPYING files in the
> distribution for more information.
> CL-USER(1): (asdf:make "str") 
> WARNING: System definition file
> #P"/gnu/store/aljfy13phr526w0iqmqz0cf2cnxkjxlb-sbcl-cl-ppcre-unicode-2.1.1/share/common-lisp/sbcl/cl-ppcre-unicode/cl-ppcre-unicode.asd"
> contains definition for system "cl-ppcre-unicode-test". Please only
> define "cl-ppcre-unicode" and secondary systems with a name starting with
> "cl-ppcre-unicode/" (e.g. "cl-ppcre-unicode/test") in that file.
>
> ;;; Computing Hangul syllable names
> T
> CL-USER(2): (in-package :str)
>
> #<PACKAGE "STR">
> STR(3): (trim "  rst  ")
>
> "rst"
> STR(4): (join " " '("foo" "bar" "baz"))
>
> "foo bar baz"
> STR(5): (concat "f" "o" "o")
>
> "foo"
> STR(6): (split "+" "foo++bar")
>
> ("foo" "" "bar")
> ```



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Loading Common Lisp Libraries with GNU/Guix in a REPL
  2021-12-10 15:03   ` Edouard Klein
@ 2021-12-12 17:01     ` Katherine Cox-Buday
  2021-12-12 19:27       ` raingloom
  0 siblings, 1 reply; 5+ messages in thread
From: Katherine Cox-Buday @ 2021-12-12 17:01 UTC (permalink / raw)
  To: Edouard Klein; +Cc: help-guix, jgart

Edouard Klein <edou@rdklein.fr> writes:

I also don't know the canonical way, but I do it a different way. I'm wondering what the simpler way to do things is? I know nothing about rlwrap. But here's how I do things:

Depending on the project, I may have a =guix.scm= package defined for it or not. This only changes how I invoke =guix shell=, not the technique.

From emacs, I run slime: with =C-u M-x slime=. It prompts me for which lisp I want to run, and then I type =guix shell -D -- sbcl=. This seems pretty simple.

I think I did have to include this in my bash initialization though. I'm not sure if it will work without it, or if there's a more correct way to do what I'm doing:

#+begin-src bash
if [ -n "${GUIX_ENVIRONMENT}" ]; then
    export XDG_CONFIG_DIRS="${GUIX_ENVIRONMENT}/etc:${XDG_CONFIG_DIRS}"
    export XDG_DATA_DIRS="${GUIX_ENVIRONMENT}/share:${XDG_DATA_DIRS}"
    export PATH="${GUIX_ENVIRONMENT}/bin:${PATH}"
    export PATH="${GUIX_ENVIRONMENT}/sbin:${PATH}"
fi
#+end_src

I hope this helps!

--
Katherine


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Loading Common Lisp Libraries with GNU/Guix in a REPL
  2021-12-12 17:01     ` Katherine Cox-Buday
@ 2021-12-12 19:27       ` raingloom
  0 siblings, 0 replies; 5+ messages in thread
From: raingloom @ 2021-12-12 19:27 UTC (permalink / raw)
  To: Katherine Cox-Buday; +Cc: jgart, Edouard Klein, help-guix

On Sun, 12 Dec 2021 11:01:34 -0600
Katherine Cox-Buday <cox.katherine.e@gmail.com> wrote:

> Edouard Klein <edou@rdklein.fr> writes:
> 
> I also don't know the canonical way, but I do it a different way. I'm
> wondering what the simpler way to do things is? I know nothing about
> rlwrap. But here's how I do things:
> 
> Depending on the project, I may have a =guix.scm= package defined for
> it or not. This only changes how I invoke =guix shell=, not the
> technique.
> 
> From emacs, I run slime: with =C-u M-x slime=. It prompts me for
> which lisp I want to run, and then I type =guix shell -D -- sbcl=.
> This seems pretty simple.
> 
> I think I did have to include this in my bash initialization though.
> I'm not sure if it will work without it, or if there's a more correct
> way to do what I'm doing:
> 
> #+begin-src bash
> if [ -n "${GUIX_ENVIRONMENT}" ]; then
>     export
> XDG_CONFIG_DIRS="${GUIX_ENVIRONMENT}/etc:${XDG_CONFIG_DIRS}" export
> XDG_DATA_DIRS="${GUIX_ENVIRONMENT}/share:${XDG_DATA_DIRS}" export
> PATH="${GUIX_ENVIRONMENT}/bin:${PATH}" export
> PATH="${GUIX_ENVIRONMENT}/sbin:${PATH}" fi
> #+end_src
> 
> I hope this helps!
> 
> --
> Katherine
> 

I think Ambrevar's Lisp REPL page mentions something about sourcing
Bash scripts from Emacs? Maybe?
https://ambrevar.xyz/lisp-repl-shell/index.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-12 19:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 10:44 Loading Common Lisp Libraries with GNU/Guix in a REPL jgart
2021-12-10 10:54 ` jgart
2021-12-10 15:03   ` Edouard Klein
2021-12-12 17:01     ` Katherine Cox-Buday
2021-12-12 19:27       ` raingloom

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