Unverified Commit fd07200b authored by adisbladis's avatar adisbladis Committed by GitHub
Browse files

Merge pull request #265585 from marsam/add-emacsPackages.lspce

emacsPackages.lspce: init at unstable-2023-10-30
parents a1592fb4 4cf14975
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ in
    inherit (pkgs) python3 git go gopls pyright;
  };

  lspce = callPackage ./manual-packages/lspce { };

  matrix-client = callPackage ./manual-packages/matrix-client {
    _map = self.map;
  };
+72 −0
Original line number Diff line number Diff line
{ 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
  '';
}