environment.scm 4.2 KB
Newer Older
1 2 3 4 5 6 7 8
;;; Run the following command to enter a development environment for
;;; guix-kernel:
;;;
;;;  $ guix environment -l environment.scm

(use-modules ((guix licenses) #:prefix license:)
             (guix packages)
             (guix download)
9 10
             (guix git-download)
             (guix gexp)
11 12 13 14
             (guix utils)
             (guix build-system gnu)
             (gnu packages)
             (gnu packages autotools)
15
             (gnu packages gnupg)
16
             (gnu packages guile)
17
             (gnu packages guile-xyz)
18 19 20 21 22 23 24 25
             (gnu packages lisp)
             (gnu packages tls)
             (gnu packages package-management)
             (gnu packages pkg-config))

(package
  (name "guix-kernel")
  (version "0.0.1")
26
  (source (local-file "." "guix-kernel"
27 28 29 30
                      #:select? (git-predicate
                                 (dirname (assoc-ref
                                           (current-source-location)
                                           'filename)))
31
                      #:recursive? #t))
32 33
  (build-system gnu-build-system)
  (arguments
34 35 36 37 38 39
   `(#:modules ((srfi srfi-26)
                (ice-9 match)
                (ice-9 popen)
                (ice-9 rdelim)
                ,@%gnu-build-system-modules)
     #:phases
40 41 42
     (modify-phases %standard-phases
       (add-before 'configure 'env
         (lambda _
43 44 45 46 47 48 49 50
           (setenv "GUILE_AUTO_COMPILE" "0")
           #t))
       (add-after 'install 'sed-kernel-json
         (lambda* (#:key inputs outputs #:allow-other-keys)
           (let* ((out   (assoc-ref outputs "out"))
                  (guix  (assoc-ref inputs  "guix"))
                  (guile (assoc-ref inputs  "guile"))
                  (json  (assoc-ref inputs  "guile-json"))
51 52
                  (git   (assoc-ref inputs  "guile-git"))
                  (bs    (assoc-ref inputs  "guile-bytestructures"))
53
                  (s-zmq (assoc-ref inputs  "guile-simple-zmq"))
54
                  (gcrypt (assoc-ref inputs  "guile-gcrypt"))
55
                  (deps  (list out s-zmq guix json git bs gcrypt))
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
                  (effective
                   (read-line
                    (open-pipe* OPEN_READ
                                (string-append guile "/bin/guile")
                                "-c" "(display (effective-version))")))
                  (path (map (cut string-append "-L\", \"" <>
                                  "/share/guile/site/"
                                  effective)
                             deps))
                  (gopath (map (cut string-append "-C\", \"" <>
                                    "/lib/guile/" effective
                                    "/site-ccache")
                               deps))
                  (kernel-dir (string-append out "/share/jupyter/kernels/guix/")))
             (substitute* (string-append kernel-dir "kernel.json")
71 72 73 74 75 76 77
               (("-s")
                (string-join
                 (list (string-join path "\",\n\t\t\"")
                       (string-join gopath "\",\n\t\t\"")
                       "-s")
                 "\",\n\t\t\""))
               (("guix-jupyter-kernel.scm")
78 79 80
                (string-append out "/share/guile/site/2.2/"
                               "guix-jupyter-kernel.scm")))
             #t))))))
81 82 83
  (native-inputs
   `(("autoconf" ,autoconf)
     ("automake" ,automake)
84 85 86 87 88 89
     ("pkg-config" ,pkg-config)

     ;; For testing.
     ("jupyter" ,(specification->package "jupyter"))
     ("python-ipython" ,(specification->package "python-ipython"))
     ("python-ipykernel" ,(specification->package "python-ipykernel"))))
90 91
  (inputs
   `(("guix" ,guix)
92
     ("guile" ,guile-2.2)))
93
  (propagated-inputs
Ludovic Courtès's avatar
Ludovic Courtès committed
94
   `(("guile-json" ,guile-json-3)
95 96
     ("guile-simple-zmq" ,guile-simple-zmq)
     ("guile-gcrypt" ,guile-gcrypt)))
97

98 99
  (home-page "https://gitlab.inria.fr/guix-hpc/guix-kernel")
  (synopsis "Guix kernel for Jupyter")
100 101 102 103 104 105
  (description
   "Guix-Jupyter is a Jupyter kernel.  It allows you to annotate notebooks
with information about their software dependencies, such that code is executed
in the right software environment.  Guix-Jupyter spawns the actual kernels
such as @code{python-ipykernel} on behalf of the notebook user and runs them
in an isolated environment, in separate namespaces.")
106
  (license license:gpl3+))