diff --git a/plugins/by-name/alpha/default.nix b/plugins/by-name/alpha/default.nix index b665cd37..424d1a5e 100644 --- a/plugins/by-name/alpha/default.nix +++ b/plugins/by-name/alpha/default.nix @@ -177,17 +177,17 @@ in extraPlugins = [ cfg.package ]; - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.alpha" [ { assertion = themeDefined || layoutDefined; message = '' - Nixvim (plugins.alpha): You have to either set a `theme` or define some sections in `layout`. + You have to either set a `theme` or define some sections in `layout`. ''; } { assertion = !(themeDefined && layoutDefined); message = '' - Nixvim (plugins.alpha): You can't define both a `theme` and custom options. + You can't define both a `theme` and custom options. Set `plugins.alpha.theme = null` if you want to configure alpha manually using the `layout` option. ''; } diff --git a/plugins/by-name/lsp-status/default.nix b/plugins/by-name/lsp-status/default.nix index c1fe47cb..50bfd0e8 100644 --- a/plugins/by-name/lsp-status/default.nix +++ b/plugins/by-name/lsp-status/default.nix @@ -86,14 +86,12 @@ lib.nixvim.plugins.mkNeovimPlugin { callSetup = false; extraConfig = cfg: { - assertions = [ - { - assertion = config.plugins.lsp.enable; - message = '' - Nixvim (plugins.lsp-status): `plugins.lsp` must be enabled to use lsp-status - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.lsp-status" { + assertion = config.plugins.lsp.enable; + message = '' + `plugins.lsp` must be enabled to use lsp-status + ''; + }; plugins.lsp = { preConfig = '' diff --git a/plugins/by-name/marks/default.nix b/plugins/by-name/marks/default.nix index 816261c0..30656f38 100644 --- a/plugins/by-name/marks/default.nix +++ b/plugins/by-name/marks/default.nix @@ -152,14 +152,12 @@ in config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; - assertions = [ - { - assertion = all (n: elem n (range 0 9)) (attrNames cfg.bookmarks); - message = '' - Nixvim (plugins.marks): The keys of the `bookmarks` option should be integers between 0 and 9. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.mark" { + assertion = all (n: elem n (range 0 9)) (attrNames cfg.bookmarks); + message = '' + The keys of the `bookmarks` option should be integers between 0 and 9. + ''; + }; extraConfigLua = let diff --git a/plugins/by-name/neoclip/default.nix b/plugins/by-name/neoclip/default.nix index 76dc38c4..2085f1fc 100644 --- a/plugins/by-name/neoclip/default.nix +++ b/plugins/by-name/neoclip/default.nix @@ -249,16 +249,14 @@ lib.nixvim.plugins.mkNeovimPlugin { ''; }; - assertions = [ - { - assertion = - isBool cfg.settings.enable_persistent_history && cfg.settings.enable_persistent_history - -> config.plugins.sqlite-lua.enable; - message = '' - Nixvim (plugins.neoclip): The persistent history sqlite storage backend needs `sqlite-lua` to function as intended. - You can enable it by setting `plugins.sqlite-lua.enable` to `true`. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.neoclip" { + assertion = + isBool cfg.settings.enable_persistent_history && cfg.settings.enable_persistent_history + -> config.plugins.sqlite-lua.enable; + message = '' + The persistent history sqlite storage backend needs `sqlite-lua` to function as intended. + You can enable it by setting `plugins.sqlite-lua.enable` to `true`. + ''; + }; }; } diff --git a/plugins/by-name/neogit/default.nix b/plugins/by-name/neogit/default.nix index 796f7d85..9afb2ca9 100644 --- a/plugins/by-name/neogit/default.nix +++ b/plugins/by-name/neogit/default.nix @@ -111,7 +111,7 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = cfg: { - assertions = + assertions = lib.nixvim.mkAssertions "plugins.neogit" ( map (name: { assertion = @@ -121,14 +121,15 @@ lib.nixvim.plugins.mkNeovimPlugin { in isEnabled -> config.plugins.${name}.enable; message = '' - Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`. + You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`. ''; }) [ "telescope" "diffview" "fzf-lua" - ]; + ] + ); extraPackages = [ diff --git a/plugins/by-name/nvim-jdtls/default.nix b/plugins/by-name/nvim-jdtls/default.nix index dbeb4f46..2d76f34f 100644 --- a/plugins/by-name/nvim-jdtls/default.nix +++ b/plugins/by-name/nvim-jdtls/default.nix @@ -119,7 +119,7 @@ in } // cfg.extraOptions; in mkIf cfg.enable { - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.nvim-jdtls" [ { assertion = cfg.cmd != null || cfg.data != null; message = "You have to either set the `plugins.nvim-jdtls.data` or the `plugins.nvim-jdtls.cmd` option."; @@ -127,7 +127,7 @@ in { assertion = cfg.cmd == null -> cfg.jdtLanguageServerPackage != null; message = '' - Nixvim (plugins.nvim-jdtls) You haven't defined a `cmd` or `jdtLanguageServerPackage`. + You haven't defined a `cmd` or `jdtLanguageServerPackage`. The default `cmd` requires `plugins.nvim-jdtls.jdtLanguageServerPackage` to be set. ''; diff --git a/plugins/by-name/package-info/default.nix b/plugins/by-name/package-info/default.nix index b2487354..606de549 100644 --- a/plugins/by-name/package-info/default.nix +++ b/plugins/by-name/package-info/default.nix @@ -108,14 +108,12 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = cfg: { - assertions = [ - { - assertion = cfg.enableTelescope -> config.plugins.telescope.enable; - message = '' - Nixvim (plugins.package-info): The telescope integration needs telescope to function as intended. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.package-info" { + assertion = cfg.enableTelescope -> config.plugins.telescope.enable; + message = '' + The telescope integration needs telescope to function as intended. + ''; + }; extraPackages = [ cfg.packageManagerPackage ]; diff --git a/plugins/by-name/rest/default.nix b/plugins/by-name/rest/default.nix index c81ea458..c61c9235 100644 --- a/plugins/by-name/rest/default.nix +++ b/plugins/by-name/rest/default.nix @@ -226,17 +226,17 @@ lib.nixvim.plugins.mkNeovimPlugin { callSetup = false; extraConfig = cfg: { - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.rest" [ { assertion = config.plugins.treesitter.enable; message = '' - Nixvim (plugins.rest): Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`. + Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`. ''; } { assertion = cfg.enableTelescope -> config.plugins.telescope.enable; message = '' - Nixvim (plugins.rest): You have `plugins.rest.enableTelescope` set to true, but `plugins.telescope.enable` is false. + You have `plugins.rest.enableTelescope` set to true, but `plugins.telescope.enable` is false. Either disable the telescope integration or enable telescope. ''; } diff --git a/plugins/by-name/rustaceanvim/default.nix b/plugins/by-name/rustaceanvim/default.nix index dea1fb69..fe935765 100644 --- a/plugins/by-name/rustaceanvim/default.nix +++ b/plugins/by-name/rustaceanvim/default.nix @@ -57,15 +57,13 @@ lib.nixvim.plugins.mkNeovimPlugin { globals.rustaceanvim = cfg.settings; - assertions = [ - { - assertion = cfg.enable -> !config.plugins.lsp.servers.rust_analyzer.enable; - message = '' - Nixvim (plugins.rustaceanvim): Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust_analyzer.enable` are true. - Disable one of them otherwise you will have multiple clients attached to each buffer. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.rustaceanvim" { + assertion = cfg.enable -> !config.plugins.lsp.servers.rust_analyzer.enable; + message = '' + Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust_analyzer.enable` are true. + Disable one of them otherwise you will have multiple clients attached to each buffer. + ''; + }; # TODO: remove after 24.11 warnings = lib.nixvim.mkWarnings "plugins.rustaceanvim" { diff --git a/plugins/by-name/startup/default.nix b/plugins/by-name/startup/default.nix index d5265036..c6b3f653 100644 --- a/plugins/by-name/startup/default.nix +++ b/plugins/by-name/startup/default.nix @@ -267,11 +267,11 @@ in sectionNames = attrNames cfg.sections; numSections = length sectionNames; in - [ + lib.nixvim.mkAssertions "plugins.startup" [ { assertion = (cfg.options.paddings == null) || (length cfg.options.paddings) == numSections; message = '' - Nixvim (plugins.startup): Make sure that `plugins.startup.options.paddings` has the same + Make sure that `plugins.startup.options.paddings` has the same number of elements as there are sections. ''; } @@ -279,7 +279,7 @@ in assertion = ((length cfg.parts) <= numSections) && (all (part: hasAttr part cfg.sections) cfg.parts); message = '' - Nixvim (plugins.startup): You should not have more section names in `plugins.startup.parts` than you have sections defined. + You should not have more section names in `plugins.startup.parts` than you have sections defined. ''; } ]; diff --git a/plugins/by-name/telekasten/default.nix b/plugins/by-name/telekasten/default.nix index 904f066b..e6b82b60 100644 --- a/plugins/by-name/telekasten/default.nix +++ b/plugins/by-name/telekasten/default.nix @@ -24,14 +24,13 @@ lib.nixvim.plugins.mkNeovimPlugin { # TODO: Remove once nixpkgs #349346 lands, since it will have telescope-nvim # as a dependency. extraConfig = cfg: { - assertions = [ - { - assertion = config.plugins.telescope.enable; - message = '' - Nixvim (plugins.telekasten): The plugin needs telescope to function as intended. - ''; - } - ]; + assertions = lib.nixvim.mkAssertions "plugins.telekasten" { + assertion = config.plugins.telescope.enable; + message = '' + Nixvim (plugins.telekasten): The plugin needs telescope to function as intended. + ''; + }; + extraPlugins = [ cfg.plenaryPackage ]; }; } diff --git a/plugins/by-name/yanky/default.nix b/plugins/by-name/yanky/default.nix index 4397fa09..c055171d 100644 --- a/plugins/by-name/yanky/default.nix +++ b/plugins/by-name/yanky/default.nix @@ -359,17 +359,17 @@ lib.nixvim.plugins.mkNeovimPlugin { ''; }; - assertions = [ + assertions = lib.nixvim.mkAssertions "plugins.yanky" [ { assertion = cfg.enableTelescope -> config.plugins.telescope.enable; message = '' - Nixvim (plugins.yanky): The telescope integration needs telescope to function as intended + The telescope integration needs telescope to function as intended ''; } { assertion = cfg.settings.ring.storage == "sqlite" -> config.plugins.sqlite-lua.enable; message = '' - Nixvim (plugins.yanky): The sqlite storage backend needs `sqlite-lua` to function as intended. + The sqlite storage backend needs `sqlite-lua` to function as intended. You can enable it by setting `plugins.sqlite-lua.enable` to `true`. ''; } diff --git a/plugins/colorschemes/palette.nix b/plugins/colorschemes/palette.nix index 22351939..58cf842d 100644 --- a/plugins/colorschemes/palette.nix +++ b/plugins/colorschemes/palette.nix @@ -118,7 +118,7 @@ lib.nixvim.plugins.mkNeovimPlugin { settingsExample = { }; extraConfig = cfg: { - assertions = + assertions = lib.nixvim.mkAssertions "colorschemes.palette" ( lib.mapAttrsToList ( name: defaultPaletteNames: @@ -131,7 +131,7 @@ lib.nixvim.plugins.mkNeovimPlugin { { assertion = lib.isString palette -> lib.elem palette allowedPaletteNames; message = '' - Nixvim (colorschemes.palette): `settings.palettes.${name}` (${palette}") is not part of the allowed ${name} palette names (${lib.concatStringsSep " " allowedPaletteNames}). + `settings.palettes.${name}` (${palette}") is not part of the allowed ${name} palette names (${lib.concatStringsSep " " allowedPaletteNames}). ''; } ) @@ -150,6 +150,7 @@ lib.nixvim.plugins.mkNeovimPlugin { "dark" "bright" ]; - }; + } + ); }; }