~ruther/ruthless-guix

ref: cee190286b47d39d7bb056aab296ebbd1f1fe833 ruthless-guix/modules/ruther/packages/lsp.scm -rw-r--r-- 7.5 KiB
cee19028 — Rutherther feat: add test for LVM root 3 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
(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))))