summaryrefslogtreecommitdiff
path: root/guix.scm
blob: 915edf15b7a83f6f805d38aea53bbd836c06b695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause

;;; Commentary:
;;
;; GNU Guix development package.
;;
;; To install:
;;
;;   guix package -f guix.scm
;;
;; To build:
;;
;;   guix build -f guix.scm
;;
;; To start the REPL:
;;
;;   guix shell -D -f guix.scm -- bash -c 'env LD_LIBRARY_PATH="$GUIX_ENVIRONMENT/lib" sbcl'
;;
;; See documents/README.org on how to setup the development environment.
;;
;;; Code:

(use-modules (guix build-system gnu)
             (guix gexp)
             (guix packages)
             (gnu packages c)
             (gnu packages glib)
             (gnu packages gnome)
             (gnu packages gstreamer)
             (gnu packages gtk)
             (gnu packages lisp)
             (gnu packages pkg-config)
             (gnu packages sqlite)
             (gnu packages tls)
             (gnu packages webkit)
             ((guix licenses) #:prefix license:))

(package
  (name "nyxt")
  (version "dev")
  (source (local-file (dirname (current-filename)) #:recursive? #t))
  (build-system gnu-build-system)
  (arguments
   `(#:make-flags (list "nyxt"
                        (string-append "DESTDIR=" (assoc-ref %outputs "out"))
                        "PREFIX=")
     #:strip-binaries? #f               ; Stripping breaks SBCL binaries.
     #:phases
     (modify-phases %standard-phases
       (delete 'configure)
       (add-after 'unpack 'fix-so-paths
         (lambda* (#:key inputs #:allow-other-keys)
           (substitute* "_build/cl-plus-ssl/src/reload.lisp"
             (("libssl.so" all)
              (string-append (assoc-ref inputs "openssl") "/lib/" all))
             (("libcrypto.so" all)
              (string-append (assoc-ref inputs "openssl") "/lib/" all)))
           (substitute* "_build/iolib/src/syscalls/ffi-functions-unix.lisp"
             (("\\(:default \"libfixposix\"\\)")
              (string-append "(:default \""
                             (assoc-ref inputs "libfixposix")
                             "/lib/libfixposix\")")))
           (substitute* "_build/cl-sqlite/sqlite-ffi.lisp"
             (("libsqlite3" all)
              (string-append (assoc-ref inputs "sqlite") "/lib/" all)))
           (substitute* "_build/cl-gobject-introspection/src/init.lisp"
             (("libgobject-2\\.0\\.so")
              (search-input-file inputs "/lib/libgobject-2.0.so"))
             (("libgirepository-1\\.0\\.so")
              (search-input-file inputs "/lib/libgirepository-1.0.so")))
           (substitute* "_build/cl-webkit/webkit2/webkit2.init.lisp"
             (("libwebkit2gtk" all)
              (string-append (assoc-ref inputs "webkitgtk-for-gtk3") "/lib/" all)))
           (substitute* "_build/cl-cffi-gtk/glib/glib.init.lisp"
             (("libglib-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all)))
             (("libgthread-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/gobject/gobject.init.lisp"
             (("libgobject-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/gio/gio.init.lisp"
             (("libgio-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/cairo/cairo.init.lisp"
             (("libcairo\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/pango/pango.init.lisp"
             (("libpango-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all)))
             (("libpangocairo-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/gdk-pixbuf/gdk-pixbuf.init.lisp"
             (("libgdk_pixbuf-[0-9.]*\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/gdk/gdk.init.lisp"
             (("libgdk-[0-9]\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))
           (substitute* "_build/cl-cffi-gtk/gdk/gdk.package.lisp"
             (("libgtk-[0-9]\\.so" all)
              (search-input-file inputs (string-append "/lib/" all))))))
       (add-before 'build 'fix-common-lisp-cache-folder
         (lambda _ (setenv "HOME" "/tmp")))
       (add-before 'check 'configure-tests
         (lambda _ (setenv "NASDF_TESTS_NO_NETWORK" "1")))
       (add-after 'install 'wrap-program
         (lambda* (#:key inputs outputs #:allow-other-keys)
           (let ((gsettings (assoc-ref inputs "gsettings-desktop-schemas")))
             (wrap-program (string-append (assoc-ref outputs "out") "/bin/nyxt")
               `("GIO_EXTRA_MODULES" prefix
                 (,(string-append (assoc-ref inputs "glib-networking")
                                  "/lib/gio/modules")))
               `("GI_TYPELIB_PATH" prefix (,(getenv "GI_TYPELIB_PATH")))
               `("LD_LIBRARY_PATH" ":" prefix (,(string-append gsettings "/lib")))
               `("XDG_DATA_DIRS" ":" prefix (,(string-append gsettings "/share"))))))))))
  (native-inputs (list sbcl))
  (inputs (list cairo
                gdk-pixbuf
                glib
                glib-networking
                gobject-introspection
                gsettings-desktop-schemas
                gst-libav
                gst-plugins-bad
                gst-plugins-base
                gst-plugins-good
                gst-plugins-ugly
                gtk+
                libfixposix
                openssl
                pango
                pkg-config
                sqlite
                webkitgtk-for-gtk3))
  (synopsis "Extensible web-browser in Common Lisp")
  (home-page "https://nyxt-browser.com/")
  (description "Nyxt is a keyboard-oriented, extensible web-browser designed
for power users.  The application has familiar Emacs and VI key-bindings and
is fully configurable and extensible in Common Lisp.")
  (license license:bsd-3))