unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: guix-devel <guix-devel@gnu.org>
Subject: Succeed to run guile-bash on Guile 3.0.5
Date: Mon, 10 May 2021 03:09:18 +0300	[thread overview]
Message-ID: <87fsyvlaa9.fsf@gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-05-10  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  0:09 Oleg Pykhalov [this message]
2021-05-10  8:42 ` Succeed to run guile-bash on Guile 3.0.5 david larsson
2021-05-11 20:35 ` Ludovic Courtès
2021-05-13  5:50   ` Oleg Pykhalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsyvlaa9.fsf@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).