unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
@ 2018-05-14  9:07 Rouby Pierre-Antoine
  2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-14  9:07 UTC (permalink / raw)
  To: 31449; +Cc: Rouby Pierre-Antoine

* gnu/package/guile.scm (guile-simple-zmq): New variable.
---
 gnu/packages/guile.scm | 87 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2af6f875e..9df59ba1d 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -66,6 +66,8 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2093,4 +2095,89 @@ It has a nice, simple s-expression based syntax.")
      "Guile-colorized provides you with a colorized REPL for GNU Guile.")
     (license license:gpl3+)))
 
+(define-public guile-simple-zmq
+  (package
+    (name "guile-simple-zmq")
+    (version "0.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jerry40/guile-simple-zmq")
+             (commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")))
+       (sha256
+        (base32
+         "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (srfi srfi-26)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (go-dir     (string-append out "/lib/guile/"
+                                           effective "/site-ccache/"))
+                (source     (string-append (assoc-ref %build-inputs "source")
+                                           "/src"))
+                (scm-file "simple-zmq.scm")
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild"))
+                (zmq  (assoc-ref %build-inputs "zeromq"))
+                (deps (list zmq))
+                (path (string-join
+                       (map (cut string-append <>
+                                 "/lib/")
+                            deps)
+                       ":")))
+           ;; Make installation directories.
+           (mkdir-p module-dir)
+           (mkdir-p go-dir)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (match (string-split file #\.)
+                                         ((base _)
+                                          (string-append go-dir "/"
+                                                         base ".go")))))
+                         ;; Install source module.
+                         (copy-file file dest-file)
+                         (substitute* dest-file
+                           (("\\(dynamic-link \"libzmq\"\\)")
+                            (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
+                                    (assoc-ref %build-inputs "zeromq"))))
+
+                         ;; Install and compile module.
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 dest-file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     (list scm-file))
+           #t))))
+    (propagated-inputs
+     `(("guile" ,guile-2.2)
+       ("zeromq" ,zeromq)))
+    (home-page "https://github.com/jerry40/guile-simple-zmq")
+    (synopsis "Guile wrapper over ZeroMQ library")
+    (description
+     "This package is Guile wrapper over ZeroMQ library.")
+    (license license:gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.17.0

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

* [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
  2018-05-14  9:07 [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Rouby Pierre-Antoine
@ 2018-05-14  9:10 ` Rouby Pierre-Antoine
  2018-05-14 13:06   ` Ludovic Courtès
  2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
  2018-05-14 12:55 ` [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Ludovic Courtès
  2 siblings, 1 reply; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-14  9:10 UTC (permalink / raw)
  To: 31449; +Cc: Rouby Pierre-Antoine

* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 127 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 9df59ba1d..bcd26461c 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2180,4 +2180,131 @@ It has a nice, simple s-expression based syntax.")
      "This package is Guile wrapper over ZeroMQ library.")
     (license license:gpl3+)))
 
+(define-public jupyter-guile-kernel
+  (package
+    (name "jupyter-guile-kernel")
+    (version "0.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jerry40/guile-kernel")
+             (commit "b751d80730f3d64a4b38df1902c3e36672d46b2b")))
+       (sha256
+        (base32
+         "0mah16mjg84l6fc52caqzk5b3m4lfi7f4fki96nbwmrgcxz9hy4g"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (srfi srfi-26)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                (go-dir     (string-append out "/lib/guile/"
+                                           effective
+                                           "/site-ccache"))
+                (source     (string-append (assoc-ref %build-inputs "source")
+                                           "/src"))
+                (scm-files '("hmac.scm"
+                             "tools.scm"
+                             "main.scm"))
+                (kernel-file "kernel.json")
+                (guild  (string-append (assoc-ref %build-inputs "guile")
+                                       "/bin/guild"))
+                (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                       "/lib"))
+                (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                (json   (assoc-ref %build-inputs "guile-json"))
+                (deps   (list g-szmq json))
+                (path   (string-join
+                         (map (cut string-append <>
+                                   "/share/guile/site/"
+                                   effective)
+                              deps)
+                         ":"))
+                (gopath (string-join
+                         (map (cut string-append <>
+                                   "/lib/guile/" effective
+                                   "/site-ccache/")
+                              deps)
+                         ":"))
+                (guile-env    (if (not (eq? (getenv "GUILE_LOAD_PATH")
+                                            #f))
+                                  (string-append
+                                   (getenv "GUILE_LOAD_PATH") ":")
+                                  ""))
+                (guile-go-env (if (not (eq? (getenv "GUILE_LOAD_COMPILED_PATH")
+                                            #f))
+                                  (string-append
+                                   (getenv "GUILE_LOAD_COMPILED_PATH") ":")
+                                  "")))
+           ;; Make installation directories.
+           (mkdir-p module-dir)
+           (mkdir-p kernel-dir)
+           (mkdir-p go-dir)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (setenv "GUILE_LOAD_PATH" (string-append guile-env path))
+           (setenv "GUILE_LOAD_COMPILED_PATH" (string-append guile-go-env
+                                                             gopath))
+
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (match (string-split file #\.)
+                                         ((base _)
+                                          (string-append go-dir "/"
+                                                         base ".go")))))
+                         ;; Install source module.
+                         (copy-file file dest-file)
+                         ;; Install compiled module.
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     scm-files)
+
+           ;; Install kernel
+           (copy-file kernel-file (string-append kernel-dir "/"
+                                                 kernel-file))
+           ;; Sed kernel file
+           (substitute* (string-append kernel-dir "/"
+                                       kernel-file)
+             (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
+              (string-append module-dir "/main.scm")))
+           (substitute* (string-append kernel-dir "/"
+                                       kernel-file)
+             (("-s")
+              (string-append "--no-auto-compile\", \"-s")))
+           #t))))
+    (propagated-inputs
+     `(("guile" ,guile-2.2)
+       ("zeromq" ,zeromq)
+       ("openssl", openssl)
+       ("guile-json" ,guile-json)
+       ("guile-simple-zmq" ,guile-simple-zmq)))
+    (synopsis "Guile kernel for jupyter")
+    (description
+     "This package is Guile kernel for Jupyter Notebook.  This software is
+write for GNU Guile 2.0.")
+    (home-page "https://github.com/jerry40/guile-kernel")
+    (license license:gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.17.0

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

* [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path.
  2018-05-14  9:07 [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Rouby Pierre-Antoine
  2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
@ 2018-05-14  9:10 ` Rouby Pierre-Antoine
  2018-05-14 13:07   ` Ludovic Courtès
  2018-05-17 11:18   ` bug#31449: " Ludovic Courtès
  2018-05-14 12:55 ` [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Ludovic Courtès
  2 siblings, 2 replies; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-14  9:10 UTC (permalink / raw)
  To: 31449; +Cc: Rouby Pierre-Antoine

* gnu/package/python.scm (jupyter)[native-search-paths]: Add it.
---
 gnu/packages/python.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index a5d533b1c..c56a5be86 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -6805,6 +6805,12 @@ Jupyter kernels such as IJulia and IRKernel.")
        ("python-jupyter-console" ,python-jupyter-console)
        ("python-nbconvert" ,python-nbconvert)
        ("python-notebook" ,python-notebook)))
+
+    (native-search-paths
+     (list (search-path-specification
+            (variable "JUPYTER_PATH")
+            (files '("share/jupyter/")))))
+
     (home-page "http://jupyter.org")
     (synopsis "Web application for interactive documents")
     (description
-- 
2.17.0

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

* [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
  2018-05-14  9:07 [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Rouby Pierre-Antoine
  2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
  2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
@ 2018-05-14 12:55 ` Ludovic Courtès
  2018-05-15  9:22   ` Rouby Pierre-Antoine
  2 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-14 12:55 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449

Hello!

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/guile.scm (guile-simple-zmq): New variable.

[...]

> +(define-public guile-simple-zmq
> +  (package
> +    (name "guile-simple-zmq")
> +    (version "0.0.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/jerry40/guile-simple-zmq")
> +             (commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")))

Nitpick: since there’s no release, I think the version number should be
like:

  (string-append "0-" (string-take commit 7))

along the lines of what the manual suggests (info "(guix) Version
Numbers").

> +    (description
> +     "This package is Guile wrapper over ZeroMQ library.")

What about:

  "This package provides a Guile programming interface to the ZeroMQ
  messaging library."

?

Could you send an updated patch?

Thanks,
Ludo’.

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

* [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
  2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
@ 2018-05-14 13:06   ` Ludovic Courtès
  2018-05-15  9:24     ` Rouby Pierre-Antoine
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-14 13:06 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/guile.scm (jupyter-guile-kernel): New variable.

[...]

> +                (scm-files '("hmac.scm"
> +                             "tools.scm"
> +                             "main.scm"))

Maybe (find-files "." "\\.scm$") would work?

> +                (guile-env    (if (not (eq? (getenv "GUILE_LOAD_PATH")
> +                                            #f))
> +                                  (string-append
> +                                   (getenv "GUILE_LOAD_PATH") ":")
> +                                  ""))
> +                (guile-go-env (if (not (eq? (getenv "GUILE_LOAD_COMPILED_PATH")
> +                                            #f))
> +                                  (string-append
> +                                   (getenv "GUILE_LOAD_COMPILED_PATH") ":")
> +                                  "")))

(not (eq? foo #f)) can be simplified to (not foo).

Also (getenv "GUILE_LOAD_PATH") and (getenv "GUILE_LOAD_COMPILED_PATH")
are always true in this case, I think, so perhaps you can remove these
two variables altogether?

> +           ;; Sed kernel file
> +           (substitute* (string-append kernel-dir "/"
> +                                       kernel-file)
> +             (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
> +              (string-append module-dir "/main.scm")))

Maybe the comment could be, IIUC:

  ;; Fix hard-coded file name in the kernel.

> +    (synopsis "Guile kernel for jupyter")
                                   ^
“Guile kernel for the Jupyter Notebook”

> +    (description
> +     "This package is Guile kernel for Jupyter Notebook.  This software is
> +write for GNU Guile 2.0.")

What about:

  “This package provides a Guile 2.x kernel for the Jupyter Notebook.
  It allows users to interact with the Guile REPL through Jupyter.”

Could you send an updated patch?

Thanks!

Ludo’.

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

* [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path.
  2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
@ 2018-05-14 13:07   ` Ludovic Courtès
  2018-05-17 11:18   ` bug#31449: " Ludovic Courtès
  1 sibling, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-14 13:07 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/python.scm (jupyter)[native-search-paths]: Add it.

LGTM, thank you!

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

* [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
  2018-05-14 12:55 ` [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Ludovic Courtès
@ 2018-05-15  9:22   ` Rouby Pierre-Antoine
  2018-05-15  9:27     ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-15  9:22 UTC (permalink / raw)
  To: ludo; +Cc: 31449, Rouby Pierre-Antoine

* gnu/package/guile.scm (guile-simple-zmq): New variable.
---
 gnu/packages/guile.scm | 91 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2af6f875e..3a0158944 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -66,6 +67,8 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2093,4 +2096,92 @@ It has a nice, simple s-expression based syntax.")
      "Guile-colorized provides you with a colorized REPL for GNU Guile.")
     (license license:gpl3+)))
 
+(define-public guile-simple-zmq
+  (let ((commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")
+        (revision "0"))
+    (package
+      (name "guile-simple-zmq")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-simple-zmq")
+               (commit commit)))
+         (sha256
+          (base32
+           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective "/site-ccache/"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-file "simple-zmq.scm")
+                  (guild (string-append (assoc-ref %build-inputs "guile")
+                                        "/bin/guild"))
+                  (zmq  (assoc-ref %build-inputs "zeromq"))
+                  (deps (list zmq))
+                  (path (string-join
+                         (map (cut string-append <>
+                                   "/lib/")
+                              deps)
+                         ":")))
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                           (substitute* dest-file
+                             (("\\(dynamic-link \"libzmq\"\\)")
+                              (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
+                                      (assoc-ref %build-inputs "zeromq"))))
+
+                           ;; Install and compile module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   dest-file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       (list scm-file))
+             #t))))
+      (propagated-inputs
+       `(("guile" ,guile-2.2)
+         ("zeromq" ,zeromq)))
+      (home-page "https://github.com/jerry40/guile-simple-zmq")
+      (synopsis "Guile wrapper over ZeroMQ library")
+      (description
+       "This package provides a Guile programming interface to the ZeroMQ
+messaging library.")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0

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

* [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
  2018-05-14 13:06   ` Ludovic Courtès
@ 2018-05-15  9:24     ` Rouby Pierre-Antoine
  2018-05-15 11:33       ` Rouby Pierre-Antoine
  0 siblings, 1 reply; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-15  9:24 UTC (permalink / raw)
  To: ludo; +Cc: 31449, Rouby Pierre-Antoine

* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 126 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 3a0158944..a6a0ada8c 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2184,4 +2184,130 @@ It has a nice, simple s-expression based syntax.")
 messaging library.")
       (license license:gpl3+))))
 
+(define-public jupyter-guile-kernel
+  (let ((commit "b751d80730f3d64a4b38df1902c3e36672d46b2b")
+        (revision "0"))
+    (package
+      (name "jupyter-guile-kernel")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-kernel")
+               (commit commit)))
+         (sha256
+          (base32
+           "0mah16mjg84l6fc52caqzk5b3m4lfi7f4fki96nbwmrgcxz9hy4g"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective
+                                             "/site-ccache"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-files '("hmac.scm"
+                               "tools.scm"
+                               "main.scm"))
+                  (kernel-file "kernel.json")
+                  (guild  (string-append (assoc-ref %build-inputs "guile")
+                                         "/bin/guild"))
+                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                         "/lib"))
+                  (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                  (json   (assoc-ref %build-inputs "guile-json"))
+                  (deps   (list g-szmq json))
+                  (path   (string-join
+                           (map (cut string-append <>
+                                     "/share/guile/site/"
+                                     effective)
+                                deps)
+                           ":"))
+                  (gopath (string-join
+                           (map (cut string-append <>
+                                     "/lib/guile/" effective
+                                     "/site-ccache/")
+                                deps)
+                           ":")))
+           
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p kernel-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (setenv "GUILE_LOAD_PATH" path)
+             (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
+           
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                         
+                           ;; Install compiled module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       scm-files)
+
+             ;; Fix executable file name
+             (rename-file (string-append module-dir "/main.scm")
+                          (string-append module-dir "/guile-jupyter-kernel.scm"))
+             (rename-file (string-append go-dir "/main.go")
+                          (string-append go-dir "/guile-jupyter-kernel.go"))
+
+             ;; Install kernel
+             (copy-file kernel-file (string-append kernel-dir "/"
+                                                   kernel-file))
+             ;; Fix hard-coded file name in the kernel
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
+                (string-append module-dir "/guile-jupyter-kernel.scm")))
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("-s")
+                (string-append "--no-auto-compile\", \"-s")))
+             #t))))
+      (propagated-inputs
+       `(("guile" ,guile-2.2)
+         ("zeromq" ,zeromq)
+         ("openssl" ,openssl)
+         ("guile-json" ,guile-json)
+         ("guile-simple-zmq" ,guile-simple-zmq)))
+      (synopsis "Guile kernel for the Jupyter Notebook")
+      (description
+       "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It
+allows users to interact with the Guile REPL through Jupyter.")
+      (home-page "https://github.com/jerry40/guile-kernel")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0

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

* [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
  2018-05-15  9:22   ` Rouby Pierre-Antoine
@ 2018-05-15  9:27     ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-15  9:27 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449

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

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/guile.scm (guile-simple-zmq): New variable.

Applied with the changes below, thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 862 bytes --]

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index f473a1cc9..9e24e90c2 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -69,7 +69,6 @@
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages networking)
-  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2133,7 +2132,8 @@ It has a nice, simple s-expression based syntax.")
                (commit commit)))
          (sha256
           (base32
-           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))
+         (file-name (git-file-name name version))))
       (build-system trivial-build-system)
       (arguments
        `(#:modules ((guix build utils))

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

* [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
  2018-05-15  9:24     ` Rouby Pierre-Antoine
@ 2018-05-15 11:33       ` Rouby Pierre-Antoine
  2018-05-17  9:42         ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Rouby Pierre-Antoine @ 2018-05-15 11:33 UTC (permalink / raw)
  To: ludo; +Cc: 31449, Rouby Pierre-Antoine

* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 121 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 3a0158944..b39dcea9e 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2184,4 +2184,125 @@ It has a nice, simple s-expression based syntax.")
 messaging library.")
       (license license:gpl3+))))
 
+(define-public jupyter-guile-kernel
+  (let ((commit "a5c5f3ea3215b65e770bcb62f71117b0ec4575ed")
+        (revision "0"))
+    (package
+      (name "jupyter-guile-kernel")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-kernel")
+               (commit commit)))
+         (sha256
+          (base32
+           "0y5jr0f0dyskvsawqbf6n0bpg8jirw4mhqbarf2a6p9lxhqha9s9"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective
+                                             "/site-ccache"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-files '("hmac.scm"
+                               "tools.scm"
+                               "guile-jupyter-kernel.scm"))
+                  (kernel-file "kernel.json")
+                  (guild  (string-append (assoc-ref %build-inputs "guile")
+                                         "/bin/guild"))
+                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                         "/lib"))
+                  (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                  (json   (assoc-ref %build-inputs "guile-json"))
+                  (deps   (list g-szmq json))
+                  (path   (string-join
+                           (map (cut string-append <>
+                                     "/share/guile/site/"
+                                     effective)
+                                deps)
+                           ":"))
+                  (gopath (string-join
+                           (map (cut string-append <>
+                                     "/lib/guile/" effective
+                                     "/site-ccache/")
+                                deps)
+                           ":")))
+           
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p kernel-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (setenv "GUILE_LOAD_PATH" path)
+             (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
+           
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                         
+                           ;; Install compiled module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       scm-files)
+             
+             ;; Install kernel
+             (copy-file kernel-file (string-append kernel-dir "/"
+                                                   kernel-file))
+             ;; Fix hard-coded file name in the kernel
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
+                (string-append module-dir "/guile-jupyter-kernel.scm")))
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("-s")
+                (string-append "--no-auto-compile\", \"-s")))
+             #t))))
+      (inputs
+       `(("zeromq" ,zeromq)))
+      (propagated-inputs
+       `(("guile-json" ,guile-json)
+         ("guile-simple-zmq" ,guile-simple-zmq)
+         ("guile" ,guile-2.2)
+         ("openssl" ,openssl)))
+      (synopsis "Guile kernel for the Jupyter Notebook")
+      (description
+       "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It
+allows users to interact with the Guile REPL through Jupyter.")
+      (home-page "https://github.com/jerry40/guile-kernel")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0

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

* [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
  2018-05-15 11:33       ` Rouby Pierre-Antoine
@ 2018-05-17  9:42         ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-17  9:42 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449

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

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/guile.scm (jupyter-guile-kernel): New variable.

Applied with the changes below, to avoid propagated inputs.

Thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4197 bytes --]

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index a4a0f87c0..84f46d1cc 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages maths)
@@ -2253,8 +2254,6 @@ messaging library.")
                   (kernel-file "kernel.json")
                   (guild  (string-append (assoc-ref %build-inputs "guile")
                                          "/bin/guild"))
-                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
-                                         "/lib"))
                   (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
                   (json   (assoc-ref %build-inputs "guile-json"))
                   (deps   (list g-szmq json))
@@ -2270,18 +2269,26 @@ messaging library.")
                                      "/site-ccache/")
                                 deps)
                            ":")))
-           
+
              ;; Make installation directories.
              (mkdir-p module-dir)
              (mkdir-p kernel-dir)
              (mkdir-p go-dir)
 
+             ;; Make a writable copy of SOURCE.
+             (copy-recursively source ".")
+
+             ;; Record the absolute file name of the 'openssl' command.
+             (substitute* "hmac.scm"
+               (("openssl")
+                (string-append (assoc-ref %build-inputs "openssl")
+                               "/bin/openssl")))
+
              ;; Compile .scm files and install.
-             (chdir source)
              (setenv "GUILE_AUTO_COMPILE" "0")
              (setenv "GUILE_LOAD_PATH" path)
              (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
-           
+
              (for-each (lambda (file)
                          (let* ((dest-file (string-append module-dir "/"
                                                           file))
@@ -2291,7 +2298,7 @@ messaging library.")
                                                            base ".go")))))
                            ;; Install source module.
                            (copy-file file dest-file)
-                         
+
                            ;; Install compiled module.
                            (unless (zero? (system* guild "compile"
                                                    "-L" source
@@ -2300,7 +2307,7 @@ messaging library.")
                              (error (format #f "Failed to compile ~s to ~s!"
                                             file go-file)))))
                        scm-files)
-             
+
              ;; Install kernel
              (copy-file kernel-file (string-append kernel-dir "/"
                                                    kernel-file))
@@ -2308,19 +2315,20 @@ messaging library.")
              (substitute* (string-append kernel-dir "/"
                                          kernel-file)
                (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
-                (string-append module-dir "/guile-jupyter-kernel.scm")))
-             (substitute* (string-append kernel-dir "/"
-                                         kernel-file)
+                (string-append module-dir "/guile-jupyter-kernel.scm"))
+               (("\"guile\"")
+                (string-append "\"" (assoc-ref %build-inputs "guile")
+                               "/bin/guile\""))
                (("-s")
                 (string-append "--no-auto-compile\", \"-s")))
+
              #t))))
       (inputs
-       `(("zeromq" ,zeromq)))
+       `(("openssl" ,openssl)
+         ("guile" ,guile-2.2)))
       (propagated-inputs
        `(("guile-json" ,guile-json)
-         ("guile-simple-zmq" ,guile-simple-zmq)
-         ("guile" ,guile-2.2)
-         ("openssl" ,openssl)))
+         ("guile-simple-zmq" ,guile-simple-zmq)))
       (synopsis "Guile kernel for the Jupyter Notebook")
       (description
        "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It

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

* bug#31449: [PATCH 3/3] gnu: jupyter: Add search path.
  2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
  2018-05-14 13:07   ` Ludovic Courtès
@ 2018-05-17 11:18   ` Ludovic Courtès
  1 sibling, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2018-05-17 11:18 UTC (permalink / raw)
  To: Rouby Pierre-Antoine; +Cc: 31449-done

Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr> skribis:

> * gnu/package/python.scm (jupyter)[native-search-paths]: Add it.

Applied as well!

So to run the Jupyter Notebook (web UI), you can do:

  guix environment --ad-hoc jupyter jupyter-guile-kernel -- jupyter notebook

And from there, point your browser to http://localhost:8888, select
New -> Guile, and you get a REPL.

Thank you!

Ludo’.

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

end of thread, other threads:[~2018-05-17 11:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14  9:07 [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Rouby Pierre-Antoine
2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
2018-05-14 13:06   ` Ludovic Courtès
2018-05-15  9:24     ` Rouby Pierre-Antoine
2018-05-15 11:33       ` Rouby Pierre-Antoine
2018-05-17  9:42         ` Ludovic Courtès
2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
2018-05-14 13:07   ` Ludovic Courtès
2018-05-17 11:18   ` bug#31449: " Ludovic Courtès
2018-05-14 12:55 ` [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Ludovic Courtès
2018-05-15  9:22   ` Rouby Pierre-Antoine
2018-05-15  9:27     ` Ludovic Courtès

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