~unwox/guix-pkgs

a41f86ded9833adf8ba647228971e57175c0a1b6 — unwox 2 months ago ab679e4
unbundle dependencies from fennel-ls
1 files changed, 115 insertions(+), 4 deletions(-)

M unwox.scm
M unwox.scm => unwox.scm +115 -4
@@ 7,7 7,7 @@
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system go)
  #:use-module (guix build-system trivial)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system vim)
  #:use-module (gnu packages autotools)


@@ 404,6 404,107 @@ return require(args[1])" install-path)
       (variable "GUIX_LUA_PATH")
       (files '("share/lua/5.3" "lib/lua/5.3")))))))

(define-public lua-dkjson
  (package
    (name "lua-dkjson")
    (version "2.7")
    (source (origin
              (method url-fetch)
              (uri (string-append "http://dkolf.de/dkjson-lua/dkjson-"
                                  version ".lua"))
              (sha256
               (base32
                "0zy2dbk4hrq0f348nlkra4yxdxh3fk0lwvdgb1fwxhhdxj11i0il"))))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((source (assoc-ref %build-inputs "source"))
                (lua-version ,(version-major+minor (package-version lua)))
                (destination (string-append (assoc-ref %outputs "out")
                                            "/share/lua/" lua-version)))
           (mkdir-p destination)
           (copy-file source (string-append destination "/dkjson.lua")))
         #t)))
    (native-inputs (list lua))
    (home-page "http://dkolf.de/dkjson-lua")
    (synopsis "JSON library for Lua")
    (description "This is a JSON module written in Lua.  It supports UTF-8.")
    (license license:expat)))

(define-public fennel-faith
  (package
    (name "fennel-faith")
    (version "0.2.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://git.sr.ht/~technomancy/faith")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1cfhaz6mjs2hdv5l7l2nw2hlskx77radc9dwli3d7kn19hngv4cy"))))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((source (assoc-ref %build-inputs "source"))
                (lua-version ,(version-major+minor (package-version lua)))
                (destination (string-append (assoc-ref %outputs "out")
                                            "/share/lua/" lua-version)))
           (with-directory-excursion source
             (install-file "faith.fnl" destination)))
         #t)))
    (home-page "https://git.sr.ht/~technomancy/faith")
    (synopsis "Fennel tests library/runner")
    (description "...")
    (license license:expat)))

(define-public lua-penlight
  (package
    (name "lua-penlight")
    (version "1.14.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/lunarmodules/Penlight")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1x6id9cgd8mjrs7cn3nl6azd2ga9ywwni546nqylh4hhd382sc73"))))
    (build-system trivial-build-system)
    (inputs
     (list lua))
    (propagated-inputs
     (list lua-filesystem))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((source (assoc-ref %build-inputs "source"))
                (lua-version ,(version-major+minor (package-version lua)))
                (destination (string-append (assoc-ref %outputs "out")
                                            "/share/lua/" lua-version)))
           (mkdir-p destination)
           (with-directory-excursion source
             (copy-recursively "lua/" destination)))
         #t)))
    (home-page "http://tieske.github.io/Penlight/")
    (synopsis "Collection of general purpose libraries for the Lua language")
    (description "Penlight is a set of pure Lua libraries focusing on
input data handling (such as reading configuration files), functional
programming (such as map, reduce, placeholder expressions,etc), and OS
path management.  Much of the functionality is inspired by the Python
standard libraries.")
    (license license:expat)))

(define-public fennel-ls
  (package
    (name "fennel-ls")


@@ 422,19 523,29 @@ return require(args[1])" install-path)
     (list
       #:make-flags
       #~(list (string-append "PREFIX=" #$output)
               (string-append #$(file-append fennel "/bin/fennel")))
               (string-append "FENNEL=" #$(file-append fennel "/bin/fennel")))
       #:test-target "test"
       #:phases
       #~(modify-phases %standard-phases
          ;; TODO: debundle dependencies
          (delete 'configure)
          (add-before 'build 'replace-bundled-dependencies
           (lambda* (#:key native-inputs inputs #:allow-other-keys)
             (invoke "make" "rm-deps")
             (install-file #$(file-append fennel "/share/lua/5.3/fennel.lua")
                           "deps/")
             (install-file #$(file-append fennel-faith "/share/lua/5.3/faith.fnl")
                          "deps/")
             (install-file #$(file-append lua-penlight "/share/lua/5.3/pl/stringio.lua")
                           "deps/pl/")
             (install-file #$(file-append lua-dkjson "/share/lua/5.3/dkjson.lua")
                           "deps/")))
          (add-before 'build 'fix-lua-shebangs
           (lambda* (#:key native-inputs inputs #:allow-other-keys)
             (substitute* "Makefile"
              (("/usr/bin/env \\$\\(LUA\\)")
               (search-input-file (or native-inputs inputs) "/bin/lua"))))))))
    (inputs (list bash-minimal))
    (native-inputs (list lua))
    (inputs (list lua))
    (home-page "https://git.sr.ht/~xerool/fennel-ls")
    (synopsis "Language server for fennel")
    (description