diff --git a/plugins/by-name/copilot-lua/default.nix b/plugins/by-name/copilot-lua/default.nix index 2739b0ee46..4ccad45472 100644 --- a/plugins/by-name/copilot-lua/default.nix +++ b/plugins/by-name/copilot-lua/default.nix @@ -176,15 +176,13 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = { - assertions = [ - { - assertion = !config.plugins.copilot-vim.enable; - message = '' - You currently have both `copilot-vim` and `copilot-lua` enabled. - Please disable one of them. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.copilot-lua" { + assertion = !config.plugins.copilot-vim.enable; + message = '' + You currently have both `copilot-vim` and `copilot-lua` enabled. + Please disable one of them. + ''; + }; }; # TODO: introduced 2025-01-07: remove after 25.05 diff --git a/plugins/by-name/git-worktree/default.nix b/plugins/by-name/git-worktree/default.nix index 7f521ea393..73c444e933 100644 --- a/plugins/by-name/git-worktree/default.nix +++ b/plugins/by-name/git-worktree/default.nix @@ -59,12 +59,12 @@ lib.nixvim.plugins.mkNeovimPlugin { extraConfig = cfg: lib.mkIf cfg.enable { - assertions = [ - { - assertion = cfg.enableTelescope -> config.plugins.telescope.enable; - message = ''Nixvim: The git-worktree telescope integration needs telescope to function as intended''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.git-worktree" { + assertion = cfg.enableTelescope -> config.plugins.telescope.enable; + message = '' + You have to enable `plugins.telescope` as `enableTelescope` is activated. + ''; + }; extraPackages = [ cfg.gitPackage ]; diff --git a/plugins/by-name/harpoon/default.nix b/plugins/by-name/harpoon/default.nix index ce073cbc45..2a1ff6b730 100644 --- a/plugins/by-name/harpoon/default.nix +++ b/plugins/by-name/harpoon/default.nix @@ -191,10 +191,10 @@ in // cfg.extraOptions; in mkIf cfg.enable { - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.harpoon" [ { 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."; } ]; diff --git a/plugins/by-name/lean/default.nix b/plugins/by-name/lean/default.nix index 5de69fd024..f979aa6322 100644 --- a/plugins/by-name/lean/default.nix +++ b/plugins/by-name/lean/default.nix @@ -231,29 +231,27 @@ in config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; - assertions = [ - { - assertion = - !( - # leanls lsp server is disabled in nvim-lspconfig - config.plugins.lsp.servers.leanls.enable - # lsp is not (!) disabled in the lean.nvim plugin - && !( - # lsp is explicitly set to `false`. - (isBool cfg.lsp.enable) && !cfg.lsp.enable - ) - ); - message = '' - You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`. - You need to either - - - 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`. - - https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.lean" { + assertion = + !( + # leanls lsp server is disabled in nvim-lspconfig + config.plugins.lsp.servers.leanls.enable + # lsp is not (!) disabled in the lean.nvim plugin + && !( + # lsp is explicitly set to `false`. + (isBool cfg.lsp.enable) && !cfg.lsp.enable + ) + ); + message = '' + You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`. + You need to either + + - 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`. + + https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls + ''; + }; extraPackages = [ cfg.leanPackage ]; diff --git a/plugins/by-name/mini/default.nix b/plugins/by-name/mini/default.nix index d2a9d320cf..53fd32ece1 100644 --- a/plugins/by-name/mini/default.nix +++ b/plugins/by-name/mini/default.nix @@ -94,15 +94,14 @@ lib.nixvim.plugins.mkNeovimPlugin { callSetup = false; hasSettings = false; extraConfig = cfg: { - assertions = [ - { - assertion = cfg.mockDevIcons -> cfg.modules ? icons; - message = '' - You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`. - This setting will have no effect without it. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "pluhins.mini" { + assertion = cfg.mockDevIcons -> cfg.modules ? icons; + message = '' + You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`. + This setting will have no effect without it. + ''; + }; + plugins.mini.luaConfig.content = lib.foldlAttrs (lines: name: config: '' ${lines} diff --git a/plugins/by-name/neotest/adapters.nix b/plugins/by-name/neotest/adapters.nix index 670a327971..c56f3c206b 100644 --- a/plugins/by-name/neotest/adapters.nix +++ b/plugins/by-name/neotest/adapters.nix @@ -37,12 +37,12 @@ let mkIf cfg.enable { extraPlugins = [ cfg.package ]; - assertions = [ - { - assertion = config.plugins.neotest.enable; - message = "Nixvim: you have enabled `plugins.neotest.adapters.${name}` but `plugins.neotest.enable` is `false`."; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.neotest.adapters.${name}" { + assertion = config.plugins.neotest.enable; + message = '' + You have to enable `plugins.telescope` as `enableTelescope` is activated. + ''; + }; warnings = lib.nixvim.mkWarnings "plugins.neotest.adapters.${name}" { when = !config.plugins.treesitter.enable; diff --git a/plugins/by-name/none-ls/default.nix b/plugins/by-name/none-ls/default.nix index e70b562d13..1ff4c766a2 100644 --- a/plugins/by-name/none-ls/default.nix +++ b/plugins/by-name/none-ls/default.nix @@ -137,17 +137,16 @@ lib.nixvim.plugins.mkNeovimPlugin { ''; }; - assertions = [ - { - assertion = cfg.enableLspFormat -> config.plugins.lsp-format.enable; - message = '' - Nixvim: You have enabled the lsp-format integration with none-ls. - However, you have not enabled `plugins.lsp-format` itself. - 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} - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.none-ls" { + assertion = cfg.enableLspFormat -> config.plugins.lsp-format.enable; + + message = '' + You have enabled the lsp-format integration with none-ls. + However, you have not enabled `plugins.lsp-format` itself. + 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} + ''; + }; # We only do this here because of enableLspFormat plugins.none-ls.luaConfig.content = '' diff --git a/plugins/by-name/package-info/default.nix b/plugins/by-name/package-info/default.nix index 606de54981..2058f1b158 100644 --- a/plugins/by-name/package-info/default.nix +++ b/plugins/by-name/package-info/default.nix @@ -111,7 +111,7 @@ lib.nixvim.plugins.mkNeovimPlugin { assertions = lib.nixvim.mkAssertions "plugins.package-info" { assertion = cfg.enableTelescope -> config.plugins.telescope.enable; message = '' - The telescope integration needs telescope to function as intended. + You have to enable `plugins.telescope` as `enableTelescope` is activated. ''; }; diff --git a/plugins/by-name/rainbow-delimiters/default.nix b/plugins/by-name/rainbow-delimiters/default.nix index 8dde51c037..7db7a0f608 100644 --- a/plugins/by-name/rainbow-delimiters/default.nix +++ b/plugins/by-name/rainbow-delimiters/default.nix @@ -119,16 +119,15 @@ with lib; when = !config.plugins.treesitter.enable; message = "This plugin needs treesitter to function as intended."; }; - assertions = [ - { - assertion = (cfg.whitelist == null) || (cfg.blacklist == null); - message = '' - Both `rainbow-delimiters.whitelist` and `rainbow-delimiters.blacklist` should not be - set simultaneously. - Please remove one of them. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.rainbow-delimiters" { + assertion = (cfg.whitelist == null) || (cfg.blacklist == null); + + message = '' + Both `rainbow-delimiters.whitelist` and `rainbow-delimiters.blacklist` should not be + set simultaneously. + Please remove one of them. + ''; + }; extraPlugins = [ cfg.package ]; diff --git a/plugins/by-name/refactoring/default.nix b/plugins/by-name/refactoring/default.nix index f61352519b..bff0d54f24 100644 --- a/plugins/by-name/refactoring/default.nix +++ b/plugins/by-name/refactoring/default.nix @@ -26,15 +26,14 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = cfg: { - assertions = [ - { - assertion = cfg.enableTelescope -> config.plugins.telescope.enable; - message = '' - Nixvim: You have enabled the `telescope` integration with refactoring-nvim. - However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`). - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.refactoring" { + assertion = cfg.enableTelescope -> config.plugins.telescope.enable; + + message = '' + You have enabled the `telescope` integration with refactoring-nvim. + However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`). + ''; + }; plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ]; }; diff --git a/plugins/by-name/telekasten/default.nix b/plugins/by-name/telekasten/default.nix index e6b82b6065..7327086e95 100644 --- a/plugins/by-name/telekasten/default.nix +++ b/plugins/by-name/telekasten/default.nix @@ -27,7 +27,7 @@ lib.nixvim.plugins.mkNeovimPlugin { assertions = lib.nixvim.mkAssertions "plugins.telekasten" { assertion = config.plugins.telescope.enable; message = '' - Nixvim (plugins.telekasten): The plugin needs telescope to function as intended. + You have to enable `plugins.telescope` as `enableTelescope` is activated. ''; }; diff --git a/plugins/by-name/tiny-devicons-auto-colors/default.nix b/plugins/by-name/tiny-devicons-auto-colors/default.nix index d78a21fdb2..b84356ac7e 100644 --- a/plugins/by-name/tiny-devicons-auto-colors/default.nix +++ b/plugins/by-name/tiny-devicons-auto-colors/default.nix @@ -90,20 +90,18 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = { - assertions = [ - { - assertion = - config.plugins.web-devicons.enable - || ( - config.plugins.mini.enable - && config.plugins.mini.modules ? icons - && config.plugins.mini.mockDevIcons - ); - message = '' - 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. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.tiny-devicons-auto-colors" { + assertion = + config.plugins.web-devicons.enable + || ( + config.plugins.mini.enable + && config.plugins.mini.modules ? icons + && config.plugins.mini.mockDevIcons + ); + message = '' + 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. + ''; + }; }; } diff --git a/plugins/by-name/todo-comments/default.nix b/plugins/by-name/todo-comments/default.nix index 9ea2926271..f25c50c079 100644 --- a/plugins/by-name/todo-comments/default.nix +++ b/plugins/by-name/todo-comments/default.nix @@ -414,18 +414,18 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = cfg: { - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.todo-comments" [ { assertion = cfg.keymaps.todoTelescope.key or null != null -> config.plugins.telescope.enable; 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`). ''; } { assertion = cfg.keymaps.todoTrouble.key or null != null -> config.plugins.trouble.enable; 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`). ''; } diff --git a/plugins/by-name/yanky/default.nix b/plugins/by-name/yanky/default.nix index c055171d90..fd195d92ae 100644 --- a/plugins/by-name/yanky/default.nix +++ b/plugins/by-name/yanky/default.nix @@ -363,7 +363,7 @@ lib.nixvim.plugins.mkNeovimPlugin { { assertion = cfg.enableTelescope -> config.plugins.telescope.enable; message = '' - The telescope integration needs telescope to function as intended + You have to enable `plugins.telescope` as `enableTelescope` is activated. ''; } {