(define-module (ruther packages lsp) #:use-module (srfi srfi-26) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix download) #:use-module (gnu packages emacs-build) #:use-module (gnu packages emacs-xyz) #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gl) #:use-module (gnu packages qt) #:use-module (gnu packages xdisorg) #:use-module (gnu packages jemalloc) #:use-module (gnu packages xorg) #:use-module (gnu packages pkg-config) #:use-module (guix build-system cargo) #:use-module (guix build-system emacs) #:use-module (ruther packages rust-crates)) (define-public lspce (let ((commit "62950e26c0d0112232246428138d80e604a2fc76") (revision "0")) (package (name "lspce") (version (git-version "1.1.0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/zbelial/lspce") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "01mvdnk53dvi6l14knxrp23v2waz894w8cfxy5r1l65ag4s7s2ny")))) (build-system cargo-build-system) (inputs (my-cargo-inputs 'lspce)) (arguments (list #:phases #~(modify-phases %standard-phases (replace 'install (lambda _ (let ((lib-dir (string-append #$output "/lib"))) (rename-file "target/release/liblspce_module.so" "lspce-module.so") (install-file "lspce-module.so" lib-dir))))) #:install-source? #f #:cargo-test-flags `(list "--release" "--" "--skip=msg::tests::serialize_request_with_null_params"))) (home-page "https://github.com/zbelial/lspce") (synopsis "LSP Client for Emacs implemented as a module using rust.") (description "LSPCE - LSP Client for Emacs, is a simple lsp client that is implemented as an Emacs module. It does not want to be a full-featured lsp client. The features it supports are: @itemize @item find definitions/references/implementatoins (as a xref backend) @item completion (as a capf function) support snippet and auto import. @item diagnostics (as a flymake backend) process diagnostics when idle. @item hover (triggered by lspce-help-at-point) @item signature/hover help (as an eldoc-documentation-functions function) @item code action (triggered by lspce-code-actions) @item rename (triggered by lspce-rename ) @item call hierarchy @end itemize ") (license license:gpl3)))) (define-public emacs-lspce (package (inherit lspce) (name "emacs-lspce") (build-system emacs-build-system) (inputs (list lspce)) (propagated-inputs (list emacs-markdown-mode emacs-yasnippet emacs-f)) (arguments (list #:phases #~(modify-phases %standard-phases (add-after 'unpack 'substitute-lspce-module-path (lambda* (#:key inputs #:allow-other-keys) (substitute* "lspce-core.el" (("\\(require 'lspce-module\\)") (string-append "(require 'lspce-module nil t) (module-load \"" (search-input-file inputs "/lib/lspce-module.so") "\")")))))))))) (define-public slint-lsp (package (name "slint-lsp") (version "1.14.1") (source (origin (method url-fetch) (uri (crate-uri "slint-lsp" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "1bhzfnmc8y41fmf0qpflxc63py1fklln1k7x5v881k7m603app6i")))) (build-system cargo-build-system) (arguments (list #:install-source? #f #:tests? #f #:phases #~(modify-phases %standard-phases (add-after 'install 'wrap-executable (lambda* _ (wrap-program (string-append #$output "/bin/slint-lsp") `("LD_LIBRARY_PATH" prefix ,(map (lambda (pkg) (string-append pkg "/lib")) ;; TODO: these should be somehow patched in... (list #$(this-package-input "wayland") #$(this-package-input "mesa") #$(this-package-input "libglvnd") #$(this-package-input "fontconfig-minimal") #$(this-package-input "egl-wayland") #$(this-package-input "libxkbcommon"))))))) (add-after 'unpack 'override-jemalloc (lambda* (#:key inputs #:allow-other-keys) (let ((jemalloc (assoc-ref inputs "jemalloc"))) ;; This flag is needed when not using the bundled jemalloc. ;; https://github.com/tikv/jemallocator/issues/19 (setenv "CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1") (setenv "JEMALLOC_OVERRIDE" (string-append jemalloc "/lib/libjemalloc.so")))))))) (native-inputs (list pkg-config fontconfig)) (inputs (cons* jemalloc egl-wayland mesa fontconfig libglvnd libx11 libxcursor libxi libxkbcommon wayland (my-cargo-inputs 'slint-lsp))) (home-page "https://slint.dev") (synopsis "language server protocol implementation for Slint") (description "This package provides a language server protocol implementation for Slint.") (license (list license:gpl3)))) (define-public slint-viewer (package (name "slint-viewer") (version "1.14.1") (source (origin (method url-fetch) (uri (crate-uri "slint-viewer" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0g1zq4yyai6h8053f39738p8qas1ylnx4i2p28wxbbw60swp69yy")))) (build-system cargo-build-system) (arguments (list #:install-source? #f #:phases #~(modify-phases %standard-phases (add-after 'install 'wrap-executable (lambda* _ (wrap-program (string-append #$output "/bin/slint-viewer") `("QT_PLUGIN_PATH" prefix ,(map (lambda (pkg) (string-append pkg "/lib/qt6/plugins")) (list #$(this-package-input "qtbase") #$(this-package-input "qtsvg") #$(this-package-input "qtwayland"))))))) (add-after 'unpack 'override-jemalloc (lambda* (#:key inputs #:allow-other-keys) (let ((jemalloc (assoc-ref inputs "jemalloc"))) ;; This flag is needed when not using the bundled jemalloc. ;; https://github.com/tikv/jemallocator/issues/19 (setenv "CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1") (setenv "JEMALLOC_OVERRIDE" (string-append jemalloc "/lib/libjemalloc.so")))))))) (inputs (cons* jemalloc libglvnd qtbase qtwayland qtsvg (my-cargo-inputs 'slint-viewer))) (home-page "https://slint.dev") (synopsis "The viewer binary for Slint") (description "This package provides The viewer binary for Slint.") (license (list license:gpl3))))