about summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs/elisp-packages/manual-packages/lspce/default.nix
blob: 29157c802411a0fa2fb34c770b32455fc8abf46b (plain) (blame)
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
{ lib
, emacs
, f
, fetchFromGitHub
, markdown-mode
, rustPlatform
, trivialBuild
, yasnippet
}:

let
  version = "unstable-2023-10-30";

  src = fetchFromGitHub {
    owner = "zbelial";
    repo = "lspce";
    rev = "34c59787bcdbf414c92d9b3bf0a0f5306cb98d64";
    hash = "sha256-kUHGdeJo2zXA410FqXGclgXmgWrll30Zv8fSprcmnIo=";
  };

  meta = {
    homepage = "https://github.com/zbelial/lspce";
    description = "LSP Client for Emacs implemented as a module using rust";
    license = lib.licenses.gpl3Only;
    maintainers = [ lib.maintainers.marsam ];
    inherit (emacs.meta) platforms;
  };

  lspce-module = rustPlatform.buildRustPackage {
    inherit version src meta;
    pname = "lspce-module";

    cargoHash = "sha256-eqSromwJrFhtJWedDVJivfbKpAtSFEtuCP098qOxFgI=";

    checkFlags = [
      # flaky test
      "--skip=msg::tests::serialize_request_with_null_params"
    ];

    postFixup = ''
      for f in $out/lib/*; do
        mv $f $out/lib/lspce-module.''${f##*.}
      done
    '';
  };
in
trivialBuild rec {
  inherit version src meta;
  pname = "lspce";

  preBuild = ''
    ln -s ${lspce-module}/lib/lspce-module* .

    # Fix byte-compilation
    substituteInPlace lspce-util.el \
      --replace "(require 'yasnippet)" "(require 'yasnippet)(require 'url-util)"
    substituteInPlace lspce-calltree.el \
      --replace "(require 'compile)" "(require 'compile)(require 'cl-lib)"
  '';

  buildInputs = propagatedUserEnvPkgs;

  propagatedUserEnvPkgs = [
    f
    markdown-mode
    yasnippet
  ];

  postInstall = ''
    install lspce-module* $LISPDIR
  '';
}