From 89aa372f0c05df5475a3dba675ca2fa682dfff31 Mon Sep 17 00:00:00 2001 From: dish Date: Wed, 5 Nov 2025 16:45:05 -0500 Subject: [PATCH] coc-rust-analyzer: migrate from nodePackages --- .../editors/vim/plugins/cocPlugins.nix | 6 ++++ .../vim/plugins/nodePackagePlugins.nix | 1 - pkgs/by-name/co/coc-rust-analyzer/package.nix | 29 +++++++++++++++++++ pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 18 ------------ 6 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 pkgs/by-name/co/coc-rust-analyzer/package.nix diff --git a/pkgs/applications/editors/vim/plugins/cocPlugins.nix b/pkgs/applications/editors/vim/plugins/cocPlugins.nix index 96a0d3668fda..9da56238a7bc 100644 --- a/pkgs/applications/editors/vim/plugins/cocPlugins.nix +++ b/pkgs/applications/editors/vim/plugins/cocPlugins.nix @@ -23,6 +23,7 @@ coc-prettier, coc-pyright, coc-r-lsp, + coc-rust-analyzer, coc-sh, coc-spell-checker, coc-toml, @@ -144,6 +145,11 @@ final: prev: { src = "${coc-r-lsp}/lib/node_modules/coc-r-lsp"; }; + coc-rust-analyzer = buildVimPlugin { + inherit (coc-rust-analyzer) pname version meta; + src = "${coc-rust-analyzer}/lib/node_modules/coc-rust-analyzer"; + }; + coc-sh = buildVimPlugin { pname = "coc-sh"; inherit (coc-sh) version meta; diff --git a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix index 0f06c534971b..1d1d2ad11547 100644 --- a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix +++ b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix @@ -8,7 +8,6 @@ let nodePackageNames = [ "coc-go" "coc-ltex" - "coc-rust-analyzer" "coc-smartf" "coc-snippets" "coc-solargraph" diff --git a/pkgs/by-name/co/coc-rust-analyzer/package.nix b/pkgs/by-name/co/coc-rust-analyzer/package.nix new file mode 100644 index 000000000000..278b29e6a592 --- /dev/null +++ b/pkgs/by-name/co/coc-rust-analyzer/package.nix @@ -0,0 +1,29 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, + nix-update-script, +}: + +buildNpmPackage { + pname = "coc-rust-analyzer"; + version = "0-unstable-2025-10-31"; + + src = fetchFromGitHub { + owner = "fannheyward"; + repo = "coc-rust-analyzer"; + rev = "6cc74fcaed6b011b98e9f8483fb608dff53147be"; + hash = "sha256-2XSx4eR9GgMbWY+IOEKuhCAVesxoZbh/KsLr0It0Cks="; + }; + + npmDepsHash = "sha256-94kuqDNsCcPuvTVeprEdjNOPw8pdpDp3IOvuoKdSEgU="; + + passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; + + meta = { + description = "Rust-analyzer extension for coc.nvim"; + homepage = "https://github.com/fannheyward/coc-rust-analyzer"; + 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 443b606592bd..a403908e46d1 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -97,6 +97,7 @@ mapAliases { coc-python = throw "coc-python was removed because it was abandoned upstream on 2020-12-24. Upstream now recommends using coc-pyright or coc-jedi instead."; # added 2024-10-15 inherit (pkgs) coc-r-lsp; # added 2025-11-05 coc-rls = throw "coc-rls was removed because rls was deprecated in 2022. You should use coc-rust-analyzer instead, as rust-analyzer is maintained."; # added 2025-10-01 + inherit (pkgs) coc-rust-analyzer; # added 2025-11-05 inherit (pkgs) coc-sh; # added 2025-10-02 inherit (pkgs) coc-spell-checker; # added 2025-10-01 inherit (pkgs) coc-toml; diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index c5a7326a4943..045fd70e00ec 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -23,7 +23,6 @@ , "clipboard-cli" , "coc-go" , "coc-ltex" -, "coc-rust-analyzer" , "coc-smartf" , "coc-snippets" , "coc-solargraph" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 4c6316b03fdd..99cb7ddb44bb 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -37659,24 +37659,6 @@ in bypassCache = true; reconstructLock = true; }; - coc-rust-analyzer = nodeEnv.buildNodePackage { - name = "coc-rust-analyzer"; - packageName = "coc-rust-analyzer"; - version = "0.81.0"; - src = fetchurl { - url = "https://registry.npmjs.org/coc-rust-analyzer/-/coc-rust-analyzer-0.81.0.tgz"; - sha512 = "skbRCe1Yjoa3r/a0dHviJxGMS8s+PFzl7lmimCUxxT3kKxairDeetNfRBw+wsDJmKBzXGhy1KH+6Cmt3WJYz5w=="; - }; - buildInputs = globalBuildInputs; - meta = { - description = "rust-analyzer for Vim/Neovim, works as an extension with coc.nvim"; - homepage = "https://github.com/fannheyward/coc-rust-analyzer#readme"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; coc-smartf = nodeEnv.buildNodePackage { name = "coc-smartf"; packageName = "coc-smartf";