From 42ec1c05896ee7703f6a8cbcdd0f18a3d2e1be45 Mon Sep 17 00:00:00 2001 From: dish Date: Sat, 8 Nov 2025 15:01:25 -0500 Subject: [PATCH] coc-nginx: migrate from nodePackages --- .../editors/vim/plugins/cocPlugins.nix | 7 ++ .../vim/plugins/nodePackagePlugins.nix | 11 +-- pkgs/by-name/co/coc-nginx/package.nix | 71 +++++++++++++++++++ pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 18 ----- 6 files changed, 81 insertions(+), 28 deletions(-) create mode 100644 pkgs/by-name/co/coc-nginx/package.nix diff --git a/pkgs/applications/editors/vim/plugins/cocPlugins.nix b/pkgs/applications/editors/vim/plugins/cocPlugins.nix index c073c194ca1e..2c89ba9de6a6 100644 --- a/pkgs/applications/editors/vim/plugins/cocPlugins.nix +++ b/pkgs/applications/editors/vim/plugins/cocPlugins.nix @@ -2,6 +2,7 @@ lib, buildVimPlugin, pkgs, + coc-nginx, }: final: prev: let @@ -60,3 +61,9 @@ lib.genAttrs cocPackages ( src = "${cocPkg}/lib/node_modules/${cocPkg.pname}"; } ) +// { + coc-nginx = buildVimPlugin { + inherit (coc-nginx) pname version meta; + src = "${coc-nginx}/lib/node_modules/@yaegassy/coc-nginx"; + }; +} diff --git a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix index 03fe172d2380..a19baf3d6f55 100644 --- a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix +++ b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix @@ -10,20 +10,13 @@ let "coc-ltex" "coc-tsserver" "coc-ultisnips" - "coc-nginx" ]; - - packageNameOverrides = { - "coc-nginx" = "@yaegassy/coc-nginx"; - }; - - getPackageName = name: packageNameOverrides.${name} or name; in lib.genAttrs nodePackageNames ( name: buildVimPlugin { pname = name; - inherit (nodePackages.${getPackageName name}) version meta; - src = "${nodePackages.${getPackageName name}}/lib/node_modules/${getPackageName name}"; + inherit (nodePackages.${name}) version meta; + src = "${nodePackages.${name}}/lib/node_modules/${name}"; } ) diff --git a/pkgs/by-name/co/coc-nginx/package.nix b/pkgs/by-name/co/coc-nginx/package.nix new file mode 100644 index 000000000000..7ffe64dc2314 --- /dev/null +++ b/pkgs/by-name/co/coc-nginx/package.nix @@ -0,0 +1,71 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + fetchYarnDeps, + yarnConfigHook, + yarnBuildHook, + yarnInstallHook, + nodejs, + nix-update-script, + esbuild, + buildGoModule, +}: +let + esbuild' = + let + version = "0.16.17"; + in + esbuild.override { + buildGoModule = + args: + buildGoModule ( + args + // { + inherit version; + src = fetchFromGitHub { + owner = "evanw"; + repo = "esbuild"; + rev = "v${version}"; + hash = "sha256-8L8h0FaexNsb3Mj6/ohA37nYLFogo5wXkAhGztGUUsQ="; + }; + vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ="; + } + ); + }; +in +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "coc-nginx"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "yaegassy"; + repo = "coc-nginx"; + tag = "v${finalAttrs.version}"; + hash = "sha256-9dca1YUQZCbzmGe+9qVJABCWZCGUUZDvtznMQEP/CCQ="; + }; + + yarnOfflineCache = fetchYarnDeps { + inherit (finalAttrs) src; + hash = "sha256-CBw2E93EWmBOCppj1gxYuAynHBZDJBPh58X099TP5mE="; + }; + + nativeBuildInputs = [ + yarnConfigHook + yarnBuildHook + yarnInstallHook + nodejs + esbuild' + ]; + + env.ESBUILD_BINARY_PATH = lib.getExe esbuild'; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "nginx-language-server extension for coc.nvim"; + homepage = "https://github.com/yaegassy/coc-nginx"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pyrox0 ]; + }; +}) diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index 3c9930c12c27..f8f4c7bddebc 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -66,6 +66,7 @@ mapAliases { "@webassemblyjs/wasm-text-gen-1.11.1" = pkgs.wasm-text-gen; # Added 2025-11-06 "@webassemblyjs/wast-refmt-1.11.1" = pkgs.wast-refmt; # Added 2025-11-06 "@withgraphite/graphite-cli" = pkgs.graphite-cli; # added 2024-01-25 + "@yaegassy/coc-nginx" = pkgs.coc-nginx; # Added 2025-11-08 "@zwave-js/server" = pkgs.zwave-js-server; # Added 2023-09-09 inherit (pkgs) autoprefixer; # added 2024-06-25 inherit (pkgs) asar; # added 2023-08-26 diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index 6ffa0b2e5281..be35ffa34b4d 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -76,5 +76,4 @@ , "vega-cli" , "vercel" , "wavedrom-cli" -, "@yaegassy/coc-nginx" ] diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index b882ae1a03f7..f7a1dc56e47d 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -40129,22 +40129,4 @@ in bypassCache = true; reconstructLock = true; }; - "@yaegassy/coc-nginx" = nodeEnv.buildNodePackage { - name = "_at_yaegassy_slash_coc-nginx"; - packageName = "@yaegassy/coc-nginx"; - version = "0.4.1"; - src = fetchurl { - url = "https://registry.npmjs.org/@yaegassy/coc-nginx/-/coc-nginx-0.4.1.tgz"; - sha512 = "GJeiQWiBDxKsWPowBLBjxnPzaRT50L9tLDtD9dZcKh8OQTdrOJGa7cqNz7T/xuqSq3r+AyD1mmeNSL7141HMsQ=="; - }; - buildInputs = globalBuildInputs; - meta = { - description = "nginx-language-server extension for coc.nvim"; - homepage = "https://github.com/yaegassy/coc-nginx#readme"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; }