From 4253df72399fb96f9ae27602a0e3850017a5e3a0 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Fri, 26 Dec 2025 23:40:39 +0100 Subject: [PATCH] vimPlugins.kulala-nvim: fix At some point, they started to use their own treesitter grammar. And on `setup()` they try to install the grammar, which obviously does not work on Nix. --- .../editors/vim/plugins/overrides.nix | 44 ++++++++++++------- .../kulala-nvim/do-not-install-grammar.patch | 15 +++++++ 2 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 pkgs/applications/editors/vim/plugins/patches/kulala-nvim/do-not-install-grammar.patch diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index bccf385e78bd..abc2faadb8d0 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -127,6 +127,7 @@ sad, # tv.nvim dependency television, + tree-sitter, }: self: super: let @@ -1558,21 +1559,34 @@ assertNoAdditions { ]; }; - kulala-nvim = super.kulala-nvim.overrideAttrs { - dependencies = with self; [ - nvim-treesitter - nvim-treesitter-parsers.http - ]; - buildInputs = [ curl ]; - postPatch = '' - substituteInPlace lua/kulala/config/defaults.lua \ - --replace-fail 'curl_path = "curl"' 'curl_path = "${lib.getExe curl}"' - ''; - nvimSkipModules = [ - # Requires some extra work to get CLI working in nixpkgs - "cli.kulala_cli" - ]; - }; + kulala-nvim = super.kulala-nvim.overrideAttrs ( + old: + let + kulala-http-grammar = neovimUtils.grammarToPlugin ( + tree-sitter.buildGrammar { + inherit (old) version src meta; + language = "kulala_http"; + location = "lua/tree-sitter"; + generate = false; + } + ); + in + { + dependencies = [ kulala-http-grammar ]; + buildInputs = [ curl ]; + + patches = [ ./patches/kulala-nvim/do-not-install-grammar.patch ]; + postPatch = '' + substituteInPlace lua/kulala/config/defaults.lua \ + --replace-fail 'curl_path = "curl"' 'curl_path = "${lib.getExe curl}"' + ''; + + nvimSkipModules = [ + # Requires some extra work to get CLI working in nixpkgs + "cli.kulala_cli" + ]; + } + ); lazydocker-nvim = super.lazydocker-nvim.overrideAttrs { runtimeDeps = [ diff --git a/pkgs/applications/editors/vim/plugins/patches/kulala-nvim/do-not-install-grammar.patch b/pkgs/applications/editors/vim/plugins/patches/kulala-nvim/do-not-install-grammar.patch new file mode 100644 index 000000000000..00a76f9c0492 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/patches/kulala-nvim/do-not-install-grammar.patch @@ -0,0 +1,15 @@ +diff --git a/lua/kulala/config/init.lua b/lua/kulala/config/init.lua +index 7298f95..d781a12 100644 +--- a/lua/kulala/config/init.lua ++++ b/lua/kulala/config/init.lua +@@ -122,6 +122,10 @@ local function setup_treesitter_master() + end + + local function set_kulala_parser() ++ assert(vim.treesitter.language.add("kulala_http")) ++ vim.treesitter.language.register("kulala_http", { "http", "rest" }) ++ do return end ++ + local parsers = vim.F.npcall(require, "nvim-treesitter.parsers") + + if not parsers then