coc-sumneko-lua: migrate from nodePackages

This commit is contained in:
dish
2025-11-06 15:37:54 -05:00
parent 7e9c70a2e2
commit 4647cf35a0
8 changed files with 1102 additions and 27 deletions
@@ -29,8 +29,9 @@
coc-snippets,
coc-solargraph,
coc-spell-checker,
coc-stylelint,
coc-sqlfluff,
coc-stylelint,
coc-sumneko-lua,
coc-toml,
}:
final: prev: {
@@ -182,14 +183,19 @@ final: prev: {
src = "${coc-spell-checker}/lib/node_modules/coc-spell-checker";
};
coc-sqlfluff = buildVimPlugin {
inherit (coc-sqlfluff) pname version meta;
src = "${coc-sqlfluff}/lib/node_modules/coc-sqlfluff";
};
coc-stylelint = buildVimPlugin {
inherit (coc-stylelint) pname version meta;
src = "${coc-stylelint}/lib/node_modules/coc-stylelint";
};
coc-sqlfluff = buildVimPlugin {
inherit (coc-sqlfluff) pname version meta;
src = "${coc-sqlfluff}/lib/node_modules/coc-sqlfluff";
coc-sumneko-lua = buildVimPlugin {
inherit (coc-sumneko-lua) pname version meta;
src = "${coc-sumneko-lua}/lib/node_modules/coc-sumneko-lua";
};
coc-toml = buildVimPlugin {
@@ -8,7 +8,6 @@ let
nodePackageNames = [
"coc-go"
"coc-ltex"
"coc-sumneko-lua"
"coc-tabnine"
"coc-texlab"
"coc-tsserver"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,60 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
esbuild,
buildGoModule,
}:
let
esbuild' =
let
version = "0.20.2";
in
esbuild.override {
buildGoModule =
args:
buildGoModule (
args
// {
inherit version;
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}
);
};
in
buildNpmPackage (finalAttrs: {
pname = "coc-sumneko-lua";
version = "0.0.42";
src = fetchFromGitHub {
owner = "xiyaowong";
repo = "coc-sumneko-lua";
tag = "v${finalAttrs.version}";
hash = "sha256-B5XvhhBbVeBQI6nWVskaopx2pJYFBiFCfbPwwwloFig=";
};
patches = [
./package-lock-fix.patch
];
npmDepsHash = "sha256-NEUDQm4hzhGJyEdiBBrSWa8fMw3DcnnPJJo0m+HgZ5U=";
nativeBuildInputs = [ esbuild' ];
env.ESBUILD_BINARY_PATH = lib.getExe esbuild';
passthru.updateScript = ./update.sh;
meta = {
description = "Lua extension using sumneko lua-language-server for coc.nvim";
homepage = "https://github.com/xiyaowong/coc-sumneko-lua";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pyrox0 ];
};
})
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nodejs nix-update git curl
WORKDIR=$(mktemp -d)
PACKAGE_DIR="$(realpath "$(dirname "$0")")"
# Get latest tag
NEW_VERSION=$(curl "https://api.github.com/repos/xiyaowong/coc-sumneko-lua/tags" | jq -r '.[] | .name' | sort --version-sort | tail -1)
# Trim leading "v" for version comparisons
NEW_VERSION=${NEW_VERSION:1}
# exit early if no change
if [[ "$UPDATE_NIX_OLD_VERSION" == "$NEW_VERSION" ]]; then
echo "package is up-to-date: $UPDATE_NIX_OLD_VERSION"
exit 0
fi
# Clone source
git clone "https://github.com/xiyaowong/coc-sumneko-lua" -b "v$NEW_VERSION" "$WORKDIR/src"
pushd "$WORKDIR/src"
npx --yes npm-package-lock-add-resolved
# Update package-lock patch
git diff >"$PACKAGE_DIR/package-lock-fix.patch"
popd
# Run nix-update
nix-update "$UPDATE_NIX_PNAME"
# Cleanup
rm -rf "$WORKDIR"
@@ -105,6 +105,7 @@ mapAliases {
inherit (pkgs) coc-spell-checker; # added 2025-10-01
inherit (pkgs) coc-sqlfluff; # Added 2025-11-05
inherit (pkgs) coc-stylelint; # Added 2025-11-05
inherit (pkgs) coc-sumneko-lua; # Added 2025-11-05
inherit (pkgs) coc-toml;
coc-tslint = throw "coc-tslint was removed because it was deprecated upstream; coc-eslint offers comparable features for eslint, which replaced tslint"; # Added 2024-10-18
coc-tslint-plugin = throw "coc-tslint-plugin was removed because it was deprecated upstream; coc-eslint offers comparable features for eslint, which replaced tslint"; # Added 2024-10-18
@@ -23,7 +23,6 @@
, "clipboard-cli"
, "coc-go"
, "coc-ltex"
, "coc-sumneko-lua"
, "coc-tabnine"
, "coc-texlab"
, "coc-tsserver"
-21
View File
@@ -37038,27 +37038,6 @@ in
bypassCache = true;
reconstructLock = true;
};
coc-sumneko-lua = nodeEnv.buildNodePackage {
name = "coc-sumneko-lua";
packageName = "coc-sumneko-lua";
version = "0.0.42";
src = fetchurl {
url = "https://registry.npmjs.org/coc-sumneko-lua/-/coc-sumneko-lua-0.0.42.tgz";
sha512 = "elUmSurb51E17VV/1W/qsAoD5qq6pFsnRK549WFMcG+AThli6nTj2Y6Ta0FA6+zh7QSjbraOlza8gk7C2w3Nfg==";
};
dependencies = [
sources."tslib-2.8.1"
];
buildInputs = globalBuildInputs;
meta = {
description = "Lua extension using sumneko lua-language-server for coc.nvim";
homepage = "https://github.com/xiyaowong/coc-sumneko-lua#readme";
license = "MIT";
};
production = true;
bypassCache = true;
reconstructLock = true;
};
coc-tabnine = nodeEnv.buildNodePackage {
name = "coc-tabnine";
packageName = "coc-tabnine";