From bd0bba7440dfd1074da63e68fd8f3890eef3ec5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Wed, 18 Mar 2026 23:33:15 +0900 Subject: [PATCH] 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 --- gnu/packages/lua.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index dab1249f1c..a31b036961 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")