mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
treewide: use mkAssertions where possible
This commit is contained in:
parent
12e658eca8
commit
ce82e5859d
14 changed files with 94 additions and 104 deletions
|
@ -176,15 +176,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.copilot-lua" {
|
||||||
{
|
assertion = !config.plugins.copilot-vim.enable;
|
||||||
assertion = !config.plugins.copilot-vim.enable;
|
message = ''
|
||||||
message = ''
|
You currently have both `copilot-vim` and `copilot-lua` enabled.
|
||||||
You currently have both `copilot-vim` and `copilot-lua` enabled.
|
Please disable one of them.
|
||||||
Please disable one of them.
|
'';
|
||||||
'';
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: introduced 2025-01-07: remove after 25.05
|
# TODO: introduced 2025-01-07: remove after 25.05
|
||||||
|
|
|
@ -59,12 +59,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
extraConfig =
|
extraConfig =
|
||||||
cfg:
|
cfg:
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.git-worktree" {
|
||||||
{
|
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
message = ''
|
||||||
message = ''Nixvim: The git-worktree telescope integration needs telescope to function as intended'';
|
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||||
}
|
'';
|
||||||
];
|
};
|
||||||
|
|
||||||
extraPackages = [ cfg.gitPackage ];
|
extraPackages = [ cfg.gitPackage ];
|
||||||
|
|
||||||
|
|
|
@ -191,10 +191,10 @@ in
|
||||||
// cfg.extraOptions;
|
// cfg.extraOptions;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.harpoon" [
|
||||||
{
|
{
|
||||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||||
message = ''Nixvim: The harpoon telescope integration needs telescope to function as intended'';
|
message = "The harpoon telescope integration needs telescope to function as intended.";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -231,29 +231,27 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.lean" {
|
||||||
{
|
assertion =
|
||||||
assertion =
|
!(
|
||||||
!(
|
# leanls lsp server is disabled in nvim-lspconfig
|
||||||
# leanls lsp server is disabled in nvim-lspconfig
|
config.plugins.lsp.servers.leanls.enable
|
||||||
config.plugins.lsp.servers.leanls.enable
|
# lsp is not (!) disabled in the lean.nvim plugin
|
||||||
# lsp is not (!) disabled in the lean.nvim plugin
|
&& !(
|
||||||
&& !(
|
# lsp is explicitly set to `false`.
|
||||||
# lsp is explicitly set to `false`.
|
(isBool cfg.lsp.enable) && !cfg.lsp.enable
|
||||||
(isBool cfg.lsp.enable) && !cfg.lsp.enable
|
)
|
||||||
)
|
);
|
||||||
);
|
message = ''
|
||||||
message = ''
|
You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`.
|
||||||
You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`.
|
You need to either
|
||||||
You need to either
|
|
||||||
|
|
||||||
- Remove the configuration in `plugins.lsp.servers.leanls` and move it to `plugins.lean.lsp`.
|
- Remove the configuration in `plugins.lsp.servers.leanls` and move it to `plugins.lean.lsp`.
|
||||||
- Explicitly disable the autoconfiguration of the lsp in the lean.nvim plugin by setting `plugins.lean.lsp` to `false`.
|
- Explicitly disable the autoconfiguration of the lsp in the lean.nvim plugin by setting `plugins.lean.lsp` to `false`.
|
||||||
|
|
||||||
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
|
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
extraPackages = [ cfg.leanPackage ];
|
extraPackages = [ cfg.leanPackage ];
|
||||||
|
|
||||||
|
|
|
@ -94,15 +94,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
callSetup = false;
|
callSetup = false;
|
||||||
hasSettings = false;
|
hasSettings = false;
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "pluhins.mini" {
|
||||||
{
|
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
|
||||||
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
|
message = ''
|
||||||
message = ''
|
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
|
||||||
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
|
This setting will have no effect without it.
|
||||||
This setting will have no effect without it.
|
'';
|
||||||
'';
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
plugins.mini.luaConfig.content =
|
plugins.mini.luaConfig.content =
|
||||||
lib.foldlAttrs (lines: name: config: ''
|
lib.foldlAttrs (lines: name: config: ''
|
||||||
${lines}
|
${lines}
|
||||||
|
|
|
@ -37,12 +37,12 @@ let
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.neotest.adapters.${name}" {
|
||||||
{
|
assertion = config.plugins.neotest.enable;
|
||||||
assertion = config.plugins.neotest.enable;
|
message = ''
|
||||||
message = "Nixvim: you have enabled `plugins.neotest.adapters.${name}` but `plugins.neotest.enable` is `false`.";
|
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||||
}
|
'';
|
||||||
];
|
};
|
||||||
|
|
||||||
warnings = lib.nixvim.mkWarnings "plugins.neotest.adapters.${name}" {
|
warnings = lib.nixvim.mkWarnings "plugins.neotest.adapters.${name}" {
|
||||||
when = !config.plugins.treesitter.enable;
|
when = !config.plugins.treesitter.enable;
|
||||||
|
|
|
@ -137,17 +137,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.none-ls" {
|
||||||
{
|
assertion = cfg.enableLspFormat -> config.plugins.lsp-format.enable;
|
||||||
assertion = cfg.enableLspFormat -> config.plugins.lsp-format.enable;
|
|
||||||
message = ''
|
message = ''
|
||||||
Nixvim: You have enabled the lsp-format integration with none-ls.
|
You have enabled the lsp-format integration with none-ls.
|
||||||
However, you have not enabled `plugins.lsp-format` itself.
|
However, you have not enabled `plugins.lsp-format` itself.
|
||||||
Note: `plugins.none-ls.enableLspFormat` is enabled by default when `plugins.lsp-format` is enabled.
|
Note: `plugins.none-ls.enableLspFormat` is enabled by default when `plugins.lsp-format` is enabled.
|
||||||
`plugins.none-ls.enableLspFormat` definitions: ${lib.options.showDefs options.plugins.none-ls.enableLspFormat.definitionsWithLocations}
|
`plugins.none-ls.enableLspFormat` definitions: ${lib.options.showDefs options.plugins.none-ls.enableLspFormat.definitionsWithLocations}
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
# We only do this here because of enableLspFormat
|
# We only do this here because of enableLspFormat
|
||||||
plugins.none-ls.luaConfig.content = ''
|
plugins.none-ls.luaConfig.content = ''
|
||||||
|
|
|
@ -111,7 +111,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
assertions = lib.nixvim.mkAssertions "plugins.package-info" {
|
assertions = lib.nixvim.mkAssertions "plugins.package-info" {
|
||||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||||
message = ''
|
message = ''
|
||||||
The telescope integration needs telescope to function as intended.
|
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -119,16 +119,15 @@ with lib;
|
||||||
when = !config.plugins.treesitter.enable;
|
when = !config.plugins.treesitter.enable;
|
||||||
message = "This plugin needs treesitter to function as intended.";
|
message = "This plugin needs treesitter to function as intended.";
|
||||||
};
|
};
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.rainbow-delimiters" {
|
||||||
{
|
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
|
||||||
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
|
|
||||||
message = ''
|
message = ''
|
||||||
Both `rainbow-delimiters.whitelist` and `rainbow-delimiters.blacklist` should not be
|
Both `rainbow-delimiters.whitelist` and `rainbow-delimiters.blacklist` should not be
|
||||||
set simultaneously.
|
set simultaneously.
|
||||||
Please remove one of them.
|
Please remove one of them.
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.refactoring" {
|
||||||
{
|
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
|
||||||
message = ''
|
message = ''
|
||||||
Nixvim: You have enabled the `telescope` integration with refactoring-nvim.
|
You have enabled the `telescope` integration with refactoring-nvim.
|
||||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ];
|
plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ];
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
assertions = lib.nixvim.mkAssertions "plugins.telekasten" {
|
assertions = lib.nixvim.mkAssertions "plugins.telekasten" {
|
||||||
assertion = config.plugins.telescope.enable;
|
assertion = config.plugins.telescope.enable;
|
||||||
message = ''
|
message = ''
|
||||||
Nixvim (plugins.telekasten): The plugin needs telescope to function as intended.
|
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -90,20 +90,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.tiny-devicons-auto-colors" {
|
||||||
{
|
assertion =
|
||||||
assertion =
|
config.plugins.web-devicons.enable
|
||||||
config.plugins.web-devicons.enable
|
|| (
|
||||||
|| (
|
config.plugins.mini.enable
|
||||||
config.plugins.mini.enable
|
&& config.plugins.mini.modules ? icons
|
||||||
&& config.plugins.mini.modules ? icons
|
&& config.plugins.mini.mockDevIcons
|
||||||
&& config.plugins.mini.mockDevIcons
|
);
|
||||||
);
|
message = ''
|
||||||
message = ''
|
Either `plugins.web-devicons` or `plugins.mini`* must be enabled to use `tiny-devicons-auto-colors`.
|
||||||
Nixvim: Either `plugins.web-devicons` or `plugins.mini`* must be enabled to use `tiny-devicons-auto-colors`.
|
*If using `plugins.mini`, you must enable the `icons` module and the `mockDevIcons` option.
|
||||||
*If using `plugins.mini`, you must enable the `icons` module and the `mockDevIcons` option.
|
'';
|
||||||
'';
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,18 +414,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
assertions = [
|
assertions = lib.nixvim.mkAssertions "plugins.todo-comments" [
|
||||||
{
|
{
|
||||||
assertion = cfg.keymaps.todoTelescope.key or null != null -> config.plugins.telescope.enable;
|
assertion = cfg.keymaps.todoTelescope.key or null != null -> config.plugins.telescope.enable;
|
||||||
message = ''
|
message = ''
|
||||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `telescope` integration.
|
You have enabled todo-comment's `telescope` integration.
|
||||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
assertion = cfg.keymaps.todoTrouble.key or null != null -> config.plugins.trouble.enable;
|
assertion = cfg.keymaps.todoTrouble.key or null != null -> config.plugins.trouble.enable;
|
||||||
message = ''
|
message = ''
|
||||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `trouble` integration.
|
You have enabled todo-comment's `trouble` integration.
|
||||||
However, you have not enabled the `trouble` plugin itself (`plugins.trouble.enable = true`).
|
However, you have not enabled the `trouble` plugin itself (`plugins.trouble.enable = true`).
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
{
|
{
|
||||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||||
message = ''
|
message = ''
|
||||||
The telescope integration needs telescope to function as intended
|
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue