guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Succeed to run guile-bash on Guile 3.0.5


From: Oleg Pykhalov
Subject: Succeed to run guile-bash on Guile 3.0.5
Date: Mon, 10 May 2021 03:09:18 +0300

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: signature.asc
Description: PGP signature


reply via email to

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