plugins: cleanup most extraConfig args

- Remove `cfg` where it is unused.
- Use `opts` where necessary.
This commit is contained in:
Matt Sturgeon 2024-11-19 15:47:49 +00:00
parent 63cfc84abe
commit 7b94afceaf
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
22 changed files with 98 additions and 99 deletions

View file

@ -78,7 +78,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
}; };
}; };
extraConfig = _: { extraConfig = {
plugins.avante.luaConfig.pre = '' plugins.avante.luaConfig.pre = ''
require('avante_lib').load() require('avante_lib').load()
''; '';

View file

@ -654,7 +654,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
}; };
}; };
extraConfig = cfg: { extraConfig = {
# TODO: added 2024-09-20 remove after 24.11 # TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons = lib.mkIf ( plugins.web-devicons = lib.mkIf (
!( !(

View file

@ -11,7 +11,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
maintainers = [ maintainers.GaetanLepage ]; maintainers = [ maintainers.GaetanLepage ];
extraConfig = cfg: { extraConfig = {
# Those options are strongly recommended by the plugin author: # Those options are strongly recommended by the plugin author:
# https://github.com/folke/edgy.nvim?tab=readme-ov-file#-installation # https://github.com/folke/edgy.nvim?tab=readme-ov-file#-installation
opts = { opts = {

View file

@ -72,21 +72,17 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
''; '';
callSetup = false; callSetup = false;
extraConfig = extraConfig = cfg: opts: {
let warnings =
opt = options.plugins.firenvim; lib.optional
in (
cfg: { config.performance.combinePlugins.enable
warnings = && !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins)
lib.optional )
( ''
config.performance.combinePlugins.enable Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`.
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins) Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
) '';
'' globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.settings;
Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`. };
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
'';
globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opt.settings;
};
} }

View file

@ -101,53 +101,48 @@ helpers.neovim-plugin.mkNeovimPlugin {
}; };
}; };
extraConfig = extraConfig = cfg: opts: {
cfg: # TODO: deprecated 2024-08-29 remove after 24.11
let warnings = lib.optionals opts.iconsEnabled.isDefined [
opt = options.plugins.fzf-lua; ''
in The option definition `plugins.fzf-lua.iconsEnabled' in ${lib.showFiles opts.iconsEnabled.files} has been deprecated; please remove it.
{ ''
# TODO: deprecated 2024-08-29 remove after 24.11 ];
warnings = lib.optionals opt.iconsEnabled.isDefined [ # TODO: added 2024-09-20 remove after 24.11
'' plugins.web-devicons =
The option definition `plugins.fzf-lua.iconsEnabled' in ${lib.showFiles opt.iconsEnabled.files} has been deprecated; please remove it. lib.mkIf
'' (
]; opts.iconsEnabled.isDefined
# TODO: added 2024-09-20 remove after 24.11 && cfg.iconsEnabled
plugins.web-devicons = && !(
lib.mkIf config.plugins.mini.enable
( && config.plugins.mini.modules ? icons
opt.iconsEnabled.isDefined && config.plugins.mini.mockDevIcons
&& cfg.iconsEnabled
&& !(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
) )
{ )
enable = lib.mkOverride 1490 true;
};
extraPackages = [ cfg.fzfPackage ];
plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
keymaps = mapAttrsToList (
key: mapping:
let
actionStr =
if isString mapping then
"${mapping}()"
else
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
in
{ {
inherit key; enable = lib.mkOverride 1490 true;
mode = mapping.mode or "n"; };
action.__raw = "function() require('fzf-lua').${actionStr} end";
options = mapping.options or { }; extraPackages = [ cfg.fzfPackage ];
}
) cfg.keymaps; plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
};
keymaps = mapAttrsToList (
key: mapping:
let
actionStr =
if isString mapping then
"${mapping}()"
else
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
in
{
inherit key;
mode = mapping.mode or "n";
action.__raw = "function() require('fzf-lua').${actionStr} end";
options = mapping.options or { };
}
) cfg.keymaps;
};
} }

View file

@ -12,7 +12,7 @@ helpers.vim-plugin.mkVimPlugin {
maintainers = [ lib.maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = _: { extraConfig = {
warnings = optional (!config.plugins.treesitter.enable) '' warnings = optional (!config.plugins.treesitter.enable) ''
Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended. Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended.
Please, enable it by setting `plugins.treesitter.enable` to `true`. Please, enable it by setting `plugins.treesitter.enable` to `true`.

View file

@ -21,7 +21,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
markdown.headline_highlights = [ "Headline1" ]; markdown.headline_highlights = [ "Headline1" ];
}; };
extraConfig = cfg: { extraConfig = {
warnings = optional (!config.plugins.treesitter.enable) '' warnings = optional (!config.plugins.treesitter.enable) ''
Nixvim (plugins.headlines): headlines requires `plugins.treesitter` to be enabled with the relevant grammars installed. Nixvim (plugins.headlines): headlines requires `plugins.treesitter` to be enabled with the relevant grammars installed.
''; '';

View file

@ -210,7 +210,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
}; };
callSetup = false; callSetup = false;
extraConfig = cfg: { extraConfig = {
globals.lightline = lib.modules.mkAliasAndWrapDefsWithPriority lib.id options.plugins.lightline.settings; globals.lightline = lib.modules.mkAliasAndWrapDefsWithPriority lib.id options.plugins.lightline.settings;
}; };
} }

View file

@ -31,7 +31,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
) )
]; ];
extraConfig = cfg: { extraConfig = {
# Strongly recommended by the plugin, to avoid duplication. # Strongly recommended by the plugin, to avoid duplication.
diagnostics.virtual_text = mkDefault false; diagnostics.virtual_text = mkDefault false;
}; };

View file

@ -43,7 +43,7 @@ mkExtension {
case_mode = "ignore_case"; case_mode = "ignore_case";
}; };
extraConfig = cfg: { extraConfig = {
# Native library is in build/libfzf.so # Native library is in build/libfzf.so
performance.combinePlugins.pathsToLink = [ "/build" ]; performance.combinePlugins.pathsToLink = [ "/build" ];
}; };

View file

@ -96,7 +96,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
zindex = 20; zindex = 20;
}; };
extraConfig = cfg: { extraConfig = {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: treesitter-context needs treesitter to function as intended" "Nixvim: treesitter-context needs treesitter to function as intended"
]; ];

View file

@ -36,7 +36,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
"skipTags" "skipTags"
]; ];
extraConfig = cfg: { extraConfig = {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: ts-autotag needs treesitter to function as intended" "Nixvim: ts-autotag needs treesitter to function as intended"
]; ];

View file

@ -1,15 +1,9 @@
{ { lib, ... }:
lib,
options,
...
}:
with lib; with lib;
let let
inherit (lib) types; inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject; inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
opt = options.plugins.which-key;
specExamples = [ specExamples = [
# Basic group with custom icon # Basic group with custom icon
{ {
@ -583,12 +577,12 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
# TODO: introduced 2024-07-29: remove after 24.11 # TODO: introduced 2024-07-29: remove after 24.11
# NOTE: this may be upgraded to a mkRemoveOptionModule when which-key removes support # NOTE: this may be upgraded to a mkRemoveOptionModule when which-key removes support
extraConfig = extraConfig =
cfg: cfg: opts:
lib.mkIf opt.registrations.isDefined { lib.mkIf opts.registrations.isDefined {
warnings = [ warnings = [
'' ''
nixvim (plugins.which-key): nixvim (plugins.which-key):
The option definition `plugins.which-key.registrations' in ${showFiles opt.registrations.files} has been deprecated in which-key v3; please remove it. The option definition `plugins.which-key.registrations' in ${showFiles opts.registrations.files} has been deprecated in which-key v3; please remove it.
You should use `plugins.which-key.settings.spec' instead. You should use `plugins.which-key.settings.spec' instead.
Note: the spec format has changed in which-key v3 Note: the spec format has changed in which-key v3
@ -596,7 +590,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
'' ''
]; ];
plugins.which-key.luaConfig.content = lib.optionalString opt.registrations.isDefined '' plugins.which-key.luaConfig.content = lib.optionalString opts.registrations.isDefined ''
require("which-key").register(${toLuaObject cfg.registrations}) require("which-key").register(${toLuaObject cfg.registrations})
''; '';
}; };

View file

@ -316,5 +316,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
}; };
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -251,5 +251,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
}; };
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -10,5 +10,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
maintainers = [ lib.maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -108,5 +108,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
on_highlights = "function(highlights, colors) end"; on_highlights = "function(highlights, colors) end";
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -21,5 +21,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
allow_italics = true; allow_italics = true;
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -10,5 +10,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
maintainers = [ lib.maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -154,5 +154,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
before_highlight = "function(group, highlight, palette) end"; before_highlight = "function(group, highlight, palette) end";
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -177,5 +177,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
on_highlights = "function(highlights, colors) end"; on_highlights = "function(highlights, colors) end";
}; };
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; extraConfig = {
opts.termguicolors = lib.mkDefault true;
};
} }

View file

@ -24,11 +24,9 @@ let
}; };
}; };
idris2_lsp = { idris2_lsp = {
extraConfig = extraConfig = {
cfg: plugins.idris2.enable = lib.mkDefault true;
mkIf cfg.enable { };
plugins.idris2.enable = lib.mkDefault true;
};
}; };
jsonls = { jsonls = {
settings = cfg: { json = cfg; }; settings = cfg: { json = cfg; };
@ -115,7 +113,7 @@ let
ts_ls = { ts_ls = {
# NOTE: Provide the plugin default filetypes so that # NOTE: Provide the plugin default filetypes so that
# `plugins.lsp.servers.volar.tslsIntegration` doesn't wipe out the default filetypes # `plugins.lsp.servers.volar.tslsIntegration` doesn't wipe out the default filetypes
extraConfig = cfg: { extraConfig = {
plugins.lsp.servers.ts_ls = { plugins.lsp.servers.ts_ls = {
filetypes = [ filetypes = [
"javascript" "javascript"