From 8fd65e57f1d1fdbe5151d23a972b00c632d33162 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Fri, 27 Dec 2024 21:02:42 -0300 Subject: [PATCH] vimPlugins.blink-cmp: fix runtime version detection error The plugin fails to load in neovim because it cannot detect the git tag used during build time. Add patch to force using src.tag instead of runtime detection, preventing the error: "Detected an out of date or missing fuzzy matching library. Can't download from github due to not being on a git tag..." --- .../vim/plugins/non-generated/blink-cmp/default.nix | 5 +++++ .../non-generated/blink-cmp/force-version.patch | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/force-version.patch diff --git a/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/default.nix b/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/default.nix index 7980b3e78838..fe4243cef6a3 100644 --- a/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/default.nix +++ b/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/default.nix @@ -6,6 +6,7 @@ vimUtils, nix-update-script, git, + replaceVars, }: let version = "0.8.2"; @@ -39,6 +40,10 @@ vimUtils.buildVimPlugin { ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt} ''; + patches = [ + (replaceVars ./force-version.patch { inherit (src) tag; }) + ]; + passthru = { updateScript = nix-update-script { attrPath = "vimPlugins.blink-cmp.blink-fuzzy-lib"; diff --git a/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/force-version.patch b/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/force-version.patch new file mode 100644 index 000000000000..3a32ac09ef30 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/non-generated/blink-cmp/force-version.patch @@ -0,0 +1,11 @@ +--- a/lua/blink/cmp/fuzzy/download/init.lua ++++ b/lua/blink/cmp/fuzzy/download/init.lua +@@ -21,7 +21,7 @@ function download.ensure_downloaded(callback) + } + end) + :map(function(version) +- local target_git_tag = download_config.force_version or version.git.tag ++ local target_git_tag = download_config.force_version or '@tag@' + + -- not built locally, not on a git tag, error + assert(