diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2026-01-08 17:03:32 +0900 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2026-01-27 10:56:28 +0900 |
| commit | 42fe5b361cefb0b4cbf00acf046a06a85cb9b4d6 (patch) | |
| tree | 2a87ec68f434a5b48d7eb5b8a0741a5dedae9a10 /gnu/packages/lua.scm | |
| parent | d888d517614597fa1734304c634a4e5245949c42 (diff) | |
gnu: Add lua-language-server.
* gnu/packages/lua.scm (lua-language-server): New variable.
Change-Id: I2e110acf855b81f3d9e7b3228fc5fbf0827cb884
Diffstat (limited to 'gnu/packages/lua.scm')
| -rw-r--r-- | gnu/packages/lua.scm | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 06010d8b9df..0c89dab2cde 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm | |||
| @@ -531,6 +531,106 @@ such as: | |||
| 531 | build system that uses the standard Lua command-line interpreter.") | 531 | build system that uses the standard Lua command-line interpreter.") |
| 532 | (license license:expat))) | 532 | (license license:expat))) |
| 533 | 533 | ||
| 534 | (define-public lua-language-server | ||
| 535 | (package | ||
| 536 | (name "lua-language-server") | ||
| 537 | (version "3.16.4") | ||
| 538 | (source (origin | ||
| 539 | (method git-fetch) | ||
| 540 | (uri (git-reference | ||
| 541 | (url "https://github.com/LuaLS/lua-language-server") | ||
| 542 | (commit version) | ||
| 543 | ;; There are quite a few bundled Lua libraries under the | ||
| 544 | ;; '3rd' and 'meta/3rd' directories; most are currently | ||
| 545 | ;; not packaged in Guix, and they all track exact | ||
| 546 | ;; commits, so it would be annoying to maintain them as | ||
| 547 | ;; separate origins (on top of having to patch the build | ||
| 548 | ;; system to unbundle them). | ||
| 549 | (recursive? #t))) | ||
| 550 | (file-name (git-file-name name version)) | ||
| 551 | (sha256 | ||
| 552 | (base32 | ||
| 553 | "0kbbwz9cjw9b8sii2hki51s968n551r8z46h9gp9bd2m3g3l1l75")))) | ||
| 554 | (build-system gnu-build-system) | ||
| 555 | (arguments | ||
| 556 | (list | ||
| 557 | ;; The test suite currently fails with luamake apparently attempting to | ||
| 558 | ;; find the bee.so shared object (see: | ||
| 559 | ;; <https://github.com/LuaLS/lua-language-server/issues/3325>). | ||
| 560 | #:tests? #f | ||
| 561 | #:phases | ||
| 562 | #~(modify-phases %standard-phases | ||
| 563 | (delete 'configure) | ||
| 564 | (replace 'build | ||
| 565 | (lambda* (#:key parallel-build? #:allow-other-keys) | ||
| 566 | (invoke "luamake" | ||
| 567 | "-notest" | ||
| 568 | "-j" (if parallel-build? | ||
| 569 | (number->string (parallel-job-count)) | ||
| 570 | "1") | ||
| 571 | "-v"))) | ||
| 572 | (replace 'check | ||
| 573 | (lambda* (#:key parallel-tests? tests? #:allow-other-keys) | ||
| 574 | (when tests? | ||
| 575 | (invoke "luamake" | ||
| 576 | "-j" (if parallel-tests? | ||
| 577 | (number->string (parallel-job-count)) | ||
| 578 | "1") | ||
| 579 | "test" "-v")))) | ||
| 580 | (replace 'install | ||
| 581 | ;; This is inspired by the package definition in Slackware. | ||
| 582 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 583 | (let* ((bin (string-append #$output "/bin")) | ||
| 584 | (lib (string-append #$output | ||
| 585 | "/libexec/lua-language-server")) | ||
| 586 | (lib/bin (string-append lib "/bin"))) | ||
| 587 | ;; XXX: The binary expects some odd layout to find its resources, | ||
| 588 | ;; hence the bin subdirectory under libexec. | ||
| 589 | (mkdir-p lib) | ||
| 590 | (for-each (lambda (x) | ||
| 591 | (copy-recursively x (string-append lib "/" x))) | ||
| 592 | (list "bin" | ||
| 593 | "debugger.lua" | ||
| 594 | "locale" | ||
| 595 | "main.lua" | ||
| 596 | "meta" | ||
| 597 | "script")) | ||
| 598 | ;; Create a custom wrapper, adjusted to log elsewhere than in | ||
| 599 | ;; its read-only location under the store. | ||
| 600 | (mkdir bin) | ||
| 601 | (call-with-output-file (string-append bin "/lua-language-server") | ||
| 602 | (lambda (p) | ||
| 603 | (format p "#!~a | ||
| 604 | exec ~a --logpath=\"/tmp/runtime-$USER/lua-language-server/log\" \ | ||
| 605 | --metapath=\"/tmp/runtime-$USER/lua-language-server/meta\" \"$@\"" | ||
| 606 | (search-input-file inputs "bin/sh") | ||
| 607 | (string-append lib/bin | ||
| 608 | "/lua-language-server")))) | ||
| 609 | (chmod (string-append bin "/lua-language-server") #o755))))))) | ||
| 610 | (native-inputs (list luamake)) | ||
| 611 | (inputs (list bash-minimal)) ;for the wrapper | ||
| 612 | (home-page "https://github.com/LuaLS/lua-language-server") | ||
| 613 | (synopsis "Lua language server") | ||
| 614 | (description "The Lua language server provides various language | ||
| 615 | features for Lua to make development easier and faster, including: | ||
| 616 | @itemize | ||
| 617 | @item Support for all recent versions of Lua, including LuaJIT | ||
| 618 | @item Jump to definition | ||
| 619 | @item Dynamic type checking | ||
| 620 | @item Find references | ||
| 621 | @item Diagnostics/Warnings | ||
| 622 | @item Syntax checking | ||
| 623 | @item Element renaming | ||
| 624 | @item Hover to view details on variables, functions, and more | ||
| 625 | @item Auto-completion | ||
| 626 | @item Support for libraries | ||
| 627 | @item Code formatting | ||
| 628 | @item Spell checking | ||
| 629 | @item Custom plugins | ||
| 630 | @item Documentation generation | ||
| 631 | @end itemize") | ||
| 632 | (license license:expat))) | ||
| 633 | |||
| 534 | (define (make-lua-ossl name lua) | 634 | (define (make-lua-ossl name lua) |
| 535 | (package | 635 | (package |
| 536 | (name name) | 636 | (name name) |
