From a5d418f44312e4da4b3427fd3b1969e063429cd2 Mon Sep 17 00:00:00 2001 From: dish Date: Wed, 5 Nov 2025 17:08:37 -0500 Subject: [PATCH] coc-yaml: migrate from nodePackages --- .../editors/vim/plugins/cocPlugins.nix | 6 ++ .../vim/plugins/nodePackagePlugins.nix | 1 - .../co/coc-yaml/package-lock-fix.patch | 89 +++++++++++++++++++ pkgs/by-name/co/coc-yaml/package.nix | 34 +++++++ pkgs/by-name/co/coc-yaml/update.sh | 28 ++++++ pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 30 ------- 8 files changed, 158 insertions(+), 32 deletions(-) create mode 100644 pkgs/by-name/co/coc-yaml/package-lock-fix.patch create mode 100644 pkgs/by-name/co/coc-yaml/package.nix create mode 100755 pkgs/by-name/co/coc-yaml/update.sh diff --git a/pkgs/applications/editors/vim/plugins/cocPlugins.nix b/pkgs/applications/editors/vim/plugins/cocPlugins.nix index b0251e64be7a..bd12588c9f87 100644 --- a/pkgs/applications/editors/vim/plugins/cocPlugins.nix +++ b/pkgs/applications/editors/vim/plugins/cocPlugins.nix @@ -38,6 +38,7 @@ coc-vimlsp, coc-vimtex, coc-wxml, + coc-yaml, }: final: prev: { coc-basedpyright = buildVimPlugin { @@ -233,4 +234,9 @@ final: prev: { inherit (coc-wxml) pname version meta; src = "${coc-wxml}/lib/node_modules/coc-wxml"; }; + + coc-yaml = buildVimPlugin { + inherit (coc-yaml) pname version meta; + src = "${coc-yaml}/lib/node_modules/coc-yaml"; + }; } diff --git a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix index 70913d977a9f..bfcd0c253693 100644 --- a/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix +++ b/pkgs/applications/editors/vim/plugins/nodePackagePlugins.nix @@ -10,7 +10,6 @@ let "coc-ltex" "coc-tsserver" "coc-ultisnips" - "coc-yaml" "coc-yank" "coc-nginx" ]; diff --git a/pkgs/by-name/co/coc-yaml/package-lock-fix.patch b/pkgs/by-name/co/coc-yaml/package-lock-fix.patch new file mode 100644 index 000000000000..9475bac1997f --- /dev/null +++ b/pkgs/by-name/co/coc-yaml/package-lock-fix.patch @@ -0,0 +1,89 @@ +diff --git i/package-lock.json w/package-lock.json +index 294a466..424d557 100644 +--- i/package-lock.json ++++ w/package-lock.json +@@ -1,12 +1,12 @@ + { + "name": "coc-yaml", +- "version": "1.9.0", ++ "version": "1.9.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "coc-yaml", +- "version": "1.9.0", ++ "version": "1.9.1", + "license": "MIT", + "dependencies": { + "prettier": "2.0.5" +@@ -27,6 +27,8 @@ + }, + "node_modules/@chemzqm/tsconfig": { + "version": "0.0.3", ++ "resolved": "https://registry.npmjs.org/@chemzqm/tsconfig/-/tsconfig-0.0.3.tgz", ++ "integrity": "sha512-MjF25vbqLYR+S+JJLgBi0vn4gZqv/C87H+yPSlVKEqlIJAJOGJOgFPUFvRS7pdRHqkv2flX/oRxzxhlu2V0X1w==", + "dev": true, + "license": "MIT" + }, +@@ -464,6 +466,8 @@ + }, + "node_modules/ansi-styles": { + "version": "6.1.0", ++ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.1.0.tgz", ++ "integrity": "sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==", + "dev": true, + "license": "MIT", + "engines": { +@@ -533,6 +537,8 @@ + }, + "node_modules/fs-extra": { + "version": "10.0.0", ++ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", ++ "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dev": true, + "license": "MIT", + "dependencies": { +@@ -546,11 +552,15 @@ + }, + "node_modules/graceful-fs": { + "version": "4.2.9", ++ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", ++ "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/jsonfile": { + "version": "6.1.0", ++ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", ++ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "license": "MIT", + "dependencies": { +@@ -562,6 +572,8 @@ + }, + "node_modules/prettier": { + "version": "2.0.5", ++ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", ++ "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" +@@ -572,6 +584,8 @@ + }, + "node_modules/request-light": { + "version": "0.5.7", ++ "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.5.7.tgz", ++ "integrity": "sha512-i/wKzvcx7Er8tZnvqSxWuNO5ZGggu2UgZAqj/RyZ0si7lBTXL7kZiI/dWxzxnQjaY7s5HEy1qK21Do4Ncr6cVw==", + "dev": true, + "license": "MIT" + }, +@@ -591,6 +605,8 @@ + }, + "node_modules/universalify": { + "version": "2.0.0", ++ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", ++ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "license": "MIT", + "engines": { diff --git a/pkgs/by-name/co/coc-yaml/package.nix b/pkgs/by-name/co/coc-yaml/package.nix new file mode 100644 index 000000000000..623fa936ddc8 --- /dev/null +++ b/pkgs/by-name/co/coc-yaml/package.nix @@ -0,0 +1,34 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, +}: + +buildNpmPackage (finalAttrs: { + pname = "coc-yaml"; + version = "1.9.1"; + + src = fetchFromGitHub { + owner = "neoclide"; + repo = "coc-yaml"; + tag = finalAttrs.version; + hash = "sha256-JzIajdgVOVJupxmHrw9GuGDZS863YaUa5FomT2tqBpc="; + }; + + patches = [ + ./package-lock-fix.patch + ]; + + npmDepsHash = "sha256-2XFXeF2ork6cPrYU2avpXSoAvLa7If6AtYtBGoxL/2g="; + + npmBuildScript = "prepare"; + + passthru.updateScript = ./update.sh; + + meta = { + description = "Yaml language server extension for coc.nvim"; + homepage = "https://github.com/neoclide/coc-yaml"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pyrox0 ]; + }; +}) diff --git a/pkgs/by-name/co/coc-yaml/update.sh b/pkgs/by-name/co/coc-yaml/update.sh new file mode 100755 index 000000000000..d3e958140a2d --- /dev/null +++ b/pkgs/by-name/co/coc-yaml/update.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash nodejs nix-update git curl jq + +WORKDIR=$(mktemp -d) +PACKAGE_DIR="$(realpath "$(dirname "$0")")" + +# Get latest tag +NEW_VERSION=$(curl "https://api.github.com/repos/neoclide/coc-yaml/tags" | jq -r '.[] | .name' | sort --version-sort | tail -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/neoclide/coc-yaml" -b "$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 --version="$NEW_VERSION" "$UPDATE_NIX_PNAME" + +# Cleanup +rm -rf "$WORKDIR" diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index f69e51c467b1..6550e5d3865e 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -115,6 +115,7 @@ mapAliases { inherit (pkgs) coc-vimlsp; # Added 2025-11-05 inherit (pkgs) coc-vimtex; # Added 2025-11-05 inherit (pkgs) coc-wxml; # Added 2025-11-05 + inherit (pkgs) coc-yaml; # Added 2025-11-05 coinmon = throw "coinmon was removed since it was abandoned upstream"; # added 2024-03-19 coffee-script = pkgs.coffeescript; # added 2023-08-18 inherit (pkgs) concurrently; # added 2024-08-05 diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index 92369bd45f56..82e37e9f7bf2 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -25,7 +25,6 @@ , "coc-ltex" , "coc-tsserver" , "coc-ultisnips" -, "coc-yaml" , "coc-yank" , "code-theme-converter" , "conventional-changelog-cli" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 904e59a24b41..ed2b84d8683a 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -24326,15 +24326,6 @@ let sha512 = "s/46sYeylUfHNjI+sA/78FAHlmIuKqI9wNnzEOGehAlUUYeObv5C2mOinXBjyUyWmJ2SfcS2/ydApH4hTF4WXQ=="; }; }; - "prettier-2.0.5" = { - name = "prettier"; - packageName = "prettier"; - version = "2.0.5"; - src = fetchurl { - url = "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz"; - sha512 = "7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg=="; - }; - }; "prettier-2.8.8" = { name = "prettier"; packageName = "prettier"; @@ -37077,27 +37068,6 @@ in bypassCache = true; reconstructLock = true; }; - coc-yaml = nodeEnv.buildNodePackage { - name = "coc-yaml"; - packageName = "coc-yaml"; - version = "1.9.1"; - src = fetchurl { - url = "https://registry.npmjs.org/coc-yaml/-/coc-yaml-1.9.1.tgz"; - sha512 = "PKDIWjnTF1193m0a5srO8oOLrOv9nKwaqka+a+sdzDjlyPoFipEADFUQVdoHwe1GYlfYe7tmfWOUCbR6ddRLrw=="; - }; - dependencies = [ - sources."prettier-2.0.5" - ]; - buildInputs = globalBuildInputs; - meta = { - description = "yaml extension for coc.nvim"; - homepage = "https://github.com/neoclide/coc-yaml#readme"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; coc-yank = nodeEnv.buildNodePackage { name = "coc-yank"; packageName = "coc-yank";