unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Succeed to run guile-bash on Guile 3.0.5
@ 2021-05-10  0:09 Oleg Pykhalov
  2021-05-10  8:42 ` david larsson
  2021-05-11 20:35 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Pykhalov @ 2021-05-10  0:09 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3670 bytes --]

Hello,

I succeed to run guile-bash on Guile 3.0.5.

First of all, when you point "guile" input to "guile-3.0-latest", you
will have the following output:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~/src/guix-wigust$ tree /gnu/store/zhjc6n1bm44wjczy459djw47ba4bvnbz-guile3.0-bash-0.1.6-0.1eabc56
/gnu/store/zhjc6n1bm44wjczy459djw47ba4bvnbz-guile3.0-bash-0.1.6-0.1eabc56
├── bin
│   └── run-scm
├── gnu
│   └── store
│       └── m5iprcg6pb5ch86r9agmqwd8v6kp7999-guile-3.0.5
│           ├── lib
│           │   └── guile
│           │       └── 3.0
│           │           └── site-ccache
│           │               ├── gnu
│           │               │   └── bash.go
...
│           └── share
│               └── guile
│                   └── site
│                       └── 3.0
│                           ├── gnu
│                           │   └── bash.scm
...
--8<---------------cut here---------------end--------------->8---

So, as a temporal workaround I just coppied those files, but without
‘.go’.  We cannot use compiled ‘.go’ Guile files, because we will get a
not helpful error message in case we use ‘define-bash-function’:
--8<---------------cut here---------------start------------->8---
Wrong type to apply: #<unspecified>
oleg@guixsd ~$ 
--8<---------------cut here---------------end--------------->8---

Here is a Guix package recipe which works on Guix 862a8861 commit:
--8<---------------cut here---------------start------------->8---
(define-public guile3.0-bash
  (package
    (inherit guile-bash)
    (name "guile3.0-bash")
    (inputs
     `(("guile" ,guile-3.0-latest)
       ,@(assoc-remove! (package-inputs guile-bash) "guile")))
    (arguments
     `(#:tests? #f
       #:phases (modify-phases %standard-phases
                  (add-after 'install 'install-guile
                    (lambda* (#:key inputs outputs #:allow-other-keys)
                      (copy-recursively
                       (string-append (assoc-ref outputs "out")
                                      (assoc-ref inputs "guile") "/share")
                       (string-append (assoc-ref outputs "out") "/share"))
                      #t)))
       ,@(package-arguments guile-bash)))))
--8<---------------cut here---------------end--------------->8---

~/.bash.d/bash.scm
--8<---------------cut here---------------start------------->8---
(use-modules (gnu bash)
             (ice-9 format)
             (system ffi)
             (srfi srfi-41))

(define-bash-function (hello)
  (display "hello")
  (use-modules (gnu packages bash))
  (pk bash)
  (newline))
--8<---------------cut here---------------end--------------->8---

Make sure to disable compilation with GUILE_AUTO_COMPILE in ~/.bashrc
--8<---------------cut here---------------start------------->8---
if [ -z $IN_NIX_SHELL ]
then
    if [ -e $HOME/.guix-profile/lib/bash/libguile-bash.so ]
    then
        enable -f "$HOME"/.guix-profile/lib/bash/libguile-bash.so scm
        GUILE_AUTO_COMPILE=0 builtin scm "$HOME"/.bash.d/bash.scm
    fi
fi
--8<---------------cut here---------------end--------------->8---

Open new Bash shell and type:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~$ hello
hello
;;; (#<package bash@5.0.16 gnu/packages/bash.scm:129 7f673a59ac80>)
--8<---------------cut here---------------end--------------->8---

Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

end of thread, other threads:[~2021-05-13  5:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  0:09 Succeed to run guile-bash on Guile 3.0.5 Oleg Pykhalov
2021-05-10  8:42 ` david larsson
2021-05-11 20:35 ` Ludovic Courtès
2021-05-13  5:50   ` Oleg Pykhalov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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