From a9214f54e791529ac6434c09af917fc33b5cb8f3 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Sun, 11 Jan 2026 15:44:40 +0100 Subject: [PATCH 1/2] neovim/{utils,wrapper}.nix: fix typos --- pkgs/applications/editors/neovim/utils.nix | 8 ++++---- pkgs/applications/editors/neovim/wrapper.nix | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index cc40709d5b9e..650a307f5639 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -60,7 +60,7 @@ let }; /** - * Builds a vim package (see ':h packages') with additionnal info: + * Builds a vim package (see ':h packages') with additional info: - the user lua configuration (specified by user) - the advised and advised by nixpkgs in passthru.initLua) - runtime dependencies (specified in plugins' "runtimeDeps") @@ -110,7 +110,7 @@ let # viml config set by the user along with the plugin inherit userPluginViml; - # recommanded configuration set in vim plugins ".passthru.initLua" + # recommended configuration set in vim plugins ".passthru.initLua" inherit pluginAdvisedLua; # A Vim "package", see ':h packages' @@ -135,8 +135,8 @@ let arguments (["-u" writeText "init.vim" GENERATEDRC)]). This makes it possible to write the config anywhere: on a per-project basis .nvimrc or in $XDG_CONFIG_HOME/nvim/init.vim to avoid sideeffects. - Indeed, note that wrapping with `-u init.vim` has sideeffects like .nvimrc wont be loaded - anymore, $MYVIMRC wont be set etc + Indeed, note that wrapping with `-u init.vim` has sideeffects like .nvimrc won't be loaded + anymore, $MYVIMRC won't be set etc */ makeNeovimConfig = { diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index c1c7fa4cdeba..0d8a0a94d4df 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -338,8 +338,7 @@ let unwrapped = neovim-unwrapped; initRc = neovimRcContent'; - tests = callPackage ./tests { - }; + tests = callPackage ./tests { }; }; meta = { From eadca93f21c3e52443a5b339db9fb084f8adcdfa Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Sun, 11 Jan 2026 15:46:05 +0100 Subject: [PATCH 2/2] wrapNeovim: symlink treesitter grammars in the wrapper --- pkgs/applications/editors/neovim/utils.nix | 4 +++- .../vim/plugins/nvim-treesitter/overrides.nix | 12 +++++------- .../editors/vim/plugins/utils/vim-utils.nix | 19 +++++++++++++++++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index 650a307f5639..98e2d60f8cb8 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -343,7 +343,9 @@ let nativeBuildInputs = [ toNvimTreesitterGrammar ]; - passthru = grammar.passthru or { }; + passthru = grammar.passthru or { } // { + isTreesitterGrammar = true; + }; meta = { platforms = lib.platforms.all; diff --git a/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix b/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix index bc2fdb75a2fd..9786265ec6de 100644 --- a/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix @@ -21,7 +21,10 @@ let vimUtils.toVimPlugin ( runCommand "nvim-treesitter-queries-${language}" { - passthru = { inherit language; }; + passthru = { + inherit language; + isTreesitterQuery = true; + }; meta.description = "Queries for ${language} from nvim-treesitter"; } '' @@ -94,12 +97,7 @@ let ]; in self.nvim-treesitter.overrideAttrs { - passthru.dependencies = [ - (symlinkJoin { - name = "nvim-treesitter-grammars"; - paths = grammarPlugins ++ queryPlugins; - }) - ]; + passthru.dependencies = grammarPlugins ++ queryPlugins; }; withAllGrammars = withPlugins (_: allGrammars); diff --git a/pkgs/applications/editors/vim/plugins/utils/vim-utils.nix b/pkgs/applications/editors/vim/plugins/utils/vim-utils.nix index 4d9f11b9b937..8679128e28a3 100644 --- a/pkgs/applications/editors/vim/plugins/utils/vim-utils.nix +++ b/pkgs/applications/editors/vim/plugins/utils/vim-utils.nix @@ -5,6 +5,7 @@ vim, vimPlugins, buildEnv, + symlinkJoin, writeText, runCommand, makeWrapper, @@ -200,12 +201,26 @@ let # and can simply pass `null`. depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt); startWithDeps = findDependenciesRecursively start; - allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins); + allPluginsAndGrammars = lib.unique (startWithDeps ++ depsOfOptionalPlugins); + allPython3Dependencies = ps: lib.flatten (map (plugin: (plugin.python3Dependencies or (_: [ ])) ps) allPlugins); python3Env = python3.withPackages allPython3Dependencies; - packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" allPlugins; + partitionGrammars = lib.partition ( + p: p.isTreesitterGrammar or false || p.isTreesitterQuery or false + ); + allPluginsAndGrammarsPartitioned = partitionGrammars allPluginsAndGrammars; + allPlugins = allPluginsAndGrammarsPartitioned.wrong; + allGrammars = allPluginsAndGrammarsPartitioned.right; + allGrammarsSymlinked = symlinkJoin { + name = "nvim-treesitter-grammars"; + paths = allGrammars; + }; + + packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" ( + if allGrammars != [ ] then allPlugins ++ [ allGrammarsSymlinked ] else allPlugins + ); packdirOpt = vimFarm "pack/${packageName}/opt" "packdir-opt" opt; # Assemble all python3 dependencies into a single `site-packages` to avoid doing recursive dependency collection # for each plugin.