summaryrefslogtreecommitdiff
path: root/gnu/packages/lua.scm
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2026-03-18 23:33:15 +0900
committerNguyễn Gia Phong <cnx@loang.net>2026-04-02 11:36:08 +0900
commitbd0bba7440dfd1074da63e68fd8f3890eef3ec5b (patch)
tree1457aa676c5d0a9e12395acbe5b81aa99af5d227 /gnu/packages/lua.scm
parent3d3e8d7d6763ac1a5ac55a08dde976f943425a05 (diff)
gnu: Add djot.
* gnu/packages/lua.scm (djot): New variable. Change-Id: I8bf67cda21d213edac3c395f97b52e4026bc9c53 Merges: https://codeberg.org/guix/guix/pulls/6999 Reviewed-by: Carlo Zancanaro <carlo@zancanaro.id.au>
Diffstat (limited to 'gnu/packages/lua.scm')
-rw-r--r--gnu/packages/lua.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index dab1249f1c6..a31b036961e 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -1264,6 +1264,43 @@ for syntax highlighting or a linting tool.")
(define-public lua5.1-djot
(make-lua-djot "lua5.1-djot" lua-5.1))
+(define-public djot
+ (package
+ (inherit lua5.1-djot)
+ (name "djot")
+ (arguments
+ (substitute-keyword-arguments (package-arguments lua5.1-djot)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'patch-makefile
+ (lambda _
+ (substitute* "Makefile"
+ (("^all: .*") "all: doc/djot.1\n"))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "luajit" "test.lua"))))
+ (add-after 'install 'install-bin-and-man
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((out-lua (string-append #$output "/share/lua/5.1"))
+ (out-bin (string-append #$output "/bin/djot")))
+ (copy-file "bin/main.lua" "bin/djot")
+ (substitute* "bin/djot"
+ (("^local djot = require" all)
+ (string-append
+ "#!"
+ (search-input-file inputs "bin/luajit")
+ "\n"
+ all)))
+ (install-file "bin/djot" (string-append #$output "/bin"))
+ (chmod out-bin #o755)
+ (wrap-program out-bin
+ `("GUIX_LUA_PATH" ";" = (,out-lua))))
+ (install-file "doc/djot.1"
+ (string-append #$output "/share/man/man1"))))))))
+ (native-inputs (list pandoc))
+ (inputs (list luajit))))
+
(define-public lutok
(package
(name "lutok")