Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release-notes/rl-2605.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@

- Xfce panel plugins have been moved to top level (e.g. if you previously added `pkgs.xfce.xfce4-whiskermenu-plugin` to `environment.systemPackages`, you will need to change it to `pkgs.xfce4-whiskermenu-plugin`).

- `vimPlugins.nvim-treesitter` has been updated to `main` branch, which is a full and incompatible rewrite. If you can't or don't want to update, you should use `vimPlugins.nvim-treesitter-legacy`.

## Other Notable Changes {#sec-nixpkgs-release-26.05-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
Expand Down
126 changes: 67 additions & 59 deletions pkgs/applications/editors/neovim/utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,66 +215,74 @@ let

grammarToPlugin =
grammar:
let
name = lib.pipe grammar [
lib.getName

# added in buildGrammar
(lib.removeSuffix "-grammar")

# grammars from tree-sitter.builtGrammars
(lib.removePrefix "tree-sitter-")
(lib.replaceStrings [ "-" ] [ "_" ])
];

nvimGrammars = lib.mapAttrsToList (
name: value:
value.origGrammar
or (throw "additions to `pkgs.vimPlugins.nvim-treesitter.grammarPlugins` set should be passed through `pkgs.neovimUtils.grammarToPlugin` first")
) vimPlugins.nvim-treesitter.grammarPlugins;
isNvimGrammar = x: builtins.elem x nvimGrammars;

toNvimTreesitterGrammar = makeSetupHook {
name = "to-nvim-treesitter-grammar";
} ./to-nvim-treesitter-grammar.sh;
in

(toVimPlugin (
stdenv.mkDerivation {
name = "treesitter-grammar-${name}";

origGrammar = grammar;
grammarName = name;

# Queries for nvim-treesitter's (not just tree-sitter's) officially
# supported languages are bundled with nvim-treesitter
# Queries from repositories for such languages are incompatible
# with nvim's implementation of treesitter.
#
# We try our best effort to only include queries for niche languages
# (there are grammars for them in nixpkgs, but they're in
# `tree-sitter-grammars.tree-sitter-*`; `vimPlugins.nvim-treesitter-parsers.*`
# only includes officially supported languages)
#
# To use grammar for a niche language, users usually do:
# packages.all.start = with final.vimPlugins; [
# (pkgs.neovimUtils.grammarToPlugin pkgs.tree-sitter-grammars.tree-sitter-LANG)
# ]
#
# See also https://github.com/NixOS/nixpkgs/pull/344849#issuecomment-2381447839
installQueries = !isNvimGrammar grammar;

dontUnpack = true;
__structuredAttrs = true;

nativeBuildInputs = [ toNvimTreesitterGrammar ];

meta = {
platforms = lib.platforms.all;
# If the grammar has already been processed by this function, return it as-is.
# This makes the function idempotent and prevents double-wrapping which mangles
# the names of the generated parser files.
if grammar ? origGrammar then
grammar
else
let
name = lib.pipe grammar [
lib.getName

# added in buildGrammar
(lib.removeSuffix "-grammar")

# grammars from tree-sitter.builtGrammars
(lib.removePrefix "tree-sitter-")
(lib.replaceStrings [ "-" ] [ "_" ])
];

nvimGrammars = lib.mapAttrsToList (
name: value:
value.origGrammar
or (throw "additions to `pkgs.vimPlugins.nvim-treesitter.grammarPlugins` set should be passed through `pkgs.neovimUtils.grammarToPlugin` first")
) vimPlugins.nvim-treesitter.grammarPlugins;
isNvimGrammar = x: builtins.elem x nvimGrammars;

toNvimTreesitterGrammar = makeSetupHook {
name = "to-nvim-treesitter-grammar";
} ./to-nvim-treesitter-grammar.sh;
in

(toVimPlugin (
stdenv.mkDerivation {
name = "nvim-treesitter-grammar-${name}";

origGrammar = grammar;
grammarName = name;

# Queries for nvim-treesitter's (not just tree-sitter's) officially
# supported languages are bundled with nvim-treesitter
# Queries from repositories for such languages are incompatible
# with nvim's implementation of treesitter.
#
# We try our best effort to only include queries for niche languages
# (there are grammars for them in nixpkgs, but they're in
# `tree-sitter-grammars.tree-sitter-*`; `vimPlugins.nvim-treesitter-parsers.*`
# only includes officially supported languages)
#
# To use grammar for a niche language, users usually do:
# packages.all.start = with final.vimPlugins; [
# (pkgs.neovimUtils.grammarToPlugin pkgs.tree-sitter-grammars.tree-sitter-LANG)
# ]
#
# See also https://github.com/NixOS/nixpkgs/pull/344849#issuecomment-2381447839
installQueries = !isNvimGrammar grammar;

dontUnpack = true;
__structuredAttrs = true;

nativeBuildInputs = [ toNvimTreesitterGrammar ];

passthru = grammar.passthru or { };

meta = {
platforms = lib.platforms.all;
}
// grammar.meta;
}
// grammar.meta;
}
));
));

/*
Fork of vimUtils.packDir that additionally generates a propagated-build-inputs-file that
Expand Down
6 changes: 3 additions & 3 deletions pkgs/applications/editors/vim/plugins/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11922,12 +11922,12 @@ final: prev: {

nvim-treesitter = buildVimPlugin {
pname = "nvim-treesitter";
version = "0.10.0-unstable-2025-05-24";
version = "0.10.0-unstable-2025-12-29";
src = fetchFromGitHub {
owner = "nvim-treesitter";
repo = "nvim-treesitter";
rev = "42fc28ba918343ebfd5565147a42a26580579482";
hash = "sha256-CVs9FTdg3oKtRjz2YqwkMr0W5qYLGfVyxyhE3qnGYbI=";
rev = "7efc1b58a8061d29786860006c7257c90a5196dc";
hash = "sha256-AMEzUaVVPzHT7vpPJUFt5UbBiN9tygH5UMio/lU/baw=";
};
meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter/";
meta.hydraPlatforms = [ ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
lib,
vimPlugins,
}:
lib.recurseIntoAttrs vimPlugins.nvim-treesitter.grammarPlugins
lib.recurseIntoAttrs vimPlugins.nvim-treesitter.parsers
Loading
Loading