emacsPackages.lspce: rework

- detach Rust module to module.nix
- trivialBuild -> melpaBuild
- updateScript
- adopt (by AndersonTorres)

Co-authored-by: Lin Jian <me@linj.tech>
This commit is contained in:
Anderson Torres 2024-07-19 10:07:46 -03:00
parent a0691657e9
commit 8c08052cc0
2 changed files with 59 additions and 50 deletions

View File

@ -1,65 +1,34 @@
{ lib {
, emacs lib,
, f callPackage,
, fetchFromGitHub f,
, markdown-mode markdown-mode,
, rustPlatform melpaBuild,
, trivialBuild nix-update-script,
, yasnippet yasnippet,
}: }:
let let
version = "1.0.0-unstable-2024-02-03"; lspce-module = callPackage ./module.nix { };
src = fetchFromGitHub {
owner = "zbelial";
repo = "lspce";
rev = "543dcf0ea9e3ff5c142c4365d90b6ae8dc27bd15";
hash = "sha256-LZWRQOKkTjNo8jecBRholW9SHpiK0SWcV8yObojpvxo=";
};
meta = {
homepage = "https://github.com/zbelial/lspce";
description = "LSP Client for Emacs implemented as a module using rust";
license = lib.licenses.gpl3Only;
maintainers = [ ];
inherit (emacs.meta) platforms;
};
lspce-module = rustPlatform.buildRustPackage {
inherit version src meta;
pname = "lspce-module";
cargoHash = "sha256-W9rsi7o4KvyRoG/pqRKOBbJtUoSW549Sh8+OV9sLcxs=";
checkFlags = [
# flaky test
"--skip=msg::tests::serialize_request_with_null_params"
];
postInstall = ''
mkdir -p $out/share/emacs/site-lisp
for f in $out/lib/*; do
mv $f $out/share/emacs/site-lisp/lspce-module.''${f##*.}
done
rmdir $out/lib
'';
};
in in
trivialBuild rec { melpaBuild {
inherit version src meta;
pname = "lspce"; pname = "lspce";
inherit (lspce-module) version src meta;
buildInputs = propagatedUserEnvPkgs; packageRequires = [
propagatedUserEnvPkgs = [
f f
markdown-mode markdown-mode
yasnippet yasnippet
lspce-module
]; ];
# to compile lspce.el, it needs lspce-module.so
files = ''(:defaults "${lib.getLib lspce-module}/lib/lspce-module.*")'';
passthru = { passthru = {
inherit lspce-module; inherit lspce-module;
updateScript = nix-update-script {
attrPath = "emacsPackages.lspce.lspce-module";
extraArgs = [ "--version=branch" ];
};
}; };
} }

View File

@ -0,0 +1,40 @@
{
lib,
fetchFromGitHub,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "lspce-module";
version = "1.1.0-unstable-2024-02-03";
src = fetchFromGitHub {
owner = "zbelial";
repo = "lspce";
rev = "543dcf0ea9e3ff5c142c4365d90b6ae8dc27bd15";
hash = "sha256-LZWRQOKkTjNo8jecBRholW9SHpiK0SWcV8yObojpvxo=";
};
cargoHash = "sha256-pjDh7epCjqVN+QMzOIwujJ2MmNYS08QcVy/2VxGZsb0=";
checkFlags = [
# flaky test
"--skip=msg::tests::serialize_request_with_null_params"
];
# rename module without changing either suffix or location
# use for loop because there seems to be two modules on darwin systems
# https://github.com/zbelial/lspce/issues/7#issue-1783708570
postInstall = ''
for f in $out/lib/*; do
mv --verbose $f $out/lib/lspce-module.''${f##*.}
done
'';
meta = {
homepage = "https://github.com/zbelial/lspce";
description = "LSP Client for Emacs implemented as a module using Rust";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ AndersonTorres ];
};
}