mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
plugins/treesitter: cleanup build-grammar deps impl
This commit is contained in:
parent
b2e8409b64
commit
2ecd643311
1 changed files with 23 additions and 19 deletions
|
@ -2,9 +2,17 @@
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
|
let
|
||||||
|
buildGrammarDeps = [
|
||||||
|
"gcc"
|
||||||
|
"nodejs"
|
||||||
|
"tree-sitter"
|
||||||
|
];
|
||||||
|
in
|
||||||
lib.nixvim.plugins.mkNeovimPlugin {
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
name = "treesitter";
|
name = "treesitter";
|
||||||
packPathName = "nvim-treesitter";
|
packPathName = "nvim-treesitter";
|
||||||
|
@ -421,7 +429,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
# NOTE: We call setup manually below.
|
# NOTE: We call setup manually below.
|
||||||
callSetup = false;
|
callSetup = false;
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: opt: {
|
||||||
plugins.treesitter.luaConfig.content =
|
plugins.treesitter.luaConfig.content =
|
||||||
# NOTE: Upstream state that the parser MUST be at the beginning of runtimepath.
|
# NOTE: Upstream state that the parser MUST be at the beginning of runtimepath.
|
||||||
# Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries.
|
# Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries.
|
||||||
|
@ -448,25 +456,21 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
pkg: pkg.withPlugins (_: cfg.grammarPackages)
|
pkg: pkg.withPlugins (_: cfg.grammarPackages)
|
||||||
);
|
);
|
||||||
|
|
||||||
dependencies = lib.mkIf (!cfg.nixGrammars) {
|
# These deps are required to build grammars when not using `nixGrammars`:
|
||||||
gcc.enable = lib.mkDefault true;
|
dependencies = lib.mkIf (!cfg.nixGrammars) (
|
||||||
nodejs.enable = lib.mkDefault true;
|
lib.genAttrs buildGrammarDeps (_: {
|
||||||
tree-sitter.enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
};
|
|
||||||
warnings = lib.nixvim.mkWarnings "plugins.treesitter" (
|
|
||||||
lib.map
|
|
||||||
(packageName: {
|
|
||||||
when = !cfg.nixGrammars && (!config.dependencies.${packageName}.enable);
|
|
||||||
message = ''
|
|
||||||
`${packageName}` is required to build grammars as you are not using `nixGrammars`.
|
|
||||||
You may want to set `dependencies.${packageName}.enable` to `true`.
|
|
||||||
'';
|
|
||||||
})
|
})
|
||||||
[
|
);
|
||||||
"gcc"
|
|
||||||
"nodejs"
|
warnings = lib.nixvim.mkWarnings "plugins.treesitter" (
|
||||||
"tree-sitter"
|
lib.map (packageName: {
|
||||||
]
|
when = !cfg.nixGrammars && !config.dependencies.${packageName}.enable;
|
||||||
|
message = ''
|
||||||
|
`${packageName}` is required to build grammars as you are not using `${opt.nixGrammars}`.
|
||||||
|
You may want to set `${options.dependencies.${packageName}.enable}` to `true`.
|
||||||
|
'';
|
||||||
|
}) buildGrammarDeps
|
||||||
);
|
);
|
||||||
|
|
||||||
opts = mkIf cfg.folding {
|
opts = mkIf cfg.folding {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue