File tree Expand file tree Collapse file tree 13 files changed +63
-72
lines changed Expand file tree Collapse file tree 13 files changed +63
-72
lines changed Original file line number Diff line number Diff line change 177177
178178 extraPlugins = [ cfg . package ] ;
179179
180- assertions = [
180+ assertions = lib . nixvim . mkAssertions "plugins.alpha" [
181181 {
182182 assertion = themeDefined || layoutDefined ;
183183 message = ''
184- Nixvim (plugins.alpha): You have to either set a `theme` or define some sections in `layout`.
184+ You have to either set a `theme` or define some sections in `layout`.
185185 '' ;
186186 }
187187 {
188188 assertion = ! ( themeDefined && layoutDefined ) ;
189189 message = ''
190- Nixvim (plugins.alpha): You can't define both a `theme` and custom options.
190+ You can't define both a `theme` and custom options.
191191 Set `plugins.alpha.theme = null` if you want to configure alpha manually using the `layout` option.
192192 '' ;
193193 }
Original file line number Diff line number Diff line change @@ -86,14 +86,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
8686
8787 callSetup = false ;
8888 extraConfig = cfg : {
89- assertions = [
90- {
91- assertion = config . plugins . lsp . enable ;
92- message = ''
93- Nixvim (plugins.lsp-status): `plugins.lsp` must be enabled to use lsp-status
94- '' ;
95- }
96- ] ;
89+ assertions = lib . nixvim . mkAssertions "plugins.lsp-status" {
90+ assertion = config . plugins . lsp . enable ;
91+ message = ''
92+ `plugins.lsp` must be enabled to use lsp-status
93+ '' ;
94+ } ;
9795
9896 plugins . lsp = {
9997 preConfig = ''
Original file line number Diff line number Diff line change 152152 config = mkIf cfg . enable {
153153 extraPlugins = [ cfg . package ] ;
154154
155- assertions = [
156- {
157- assertion = all ( n : elem n ( range 0 9 ) ) ( attrNames cfg . bookmarks ) ;
158- message = ''
159- Nixvim (plugins.marks): The keys of the `bookmarks` option should be integers between 0 and 9.
160- '' ;
161- }
162- ] ;
155+ assertions = lib . nixvim . mkAssertions "plugins.mark" {
156+ assertion = all ( n : elem n ( range 0 9 ) ) ( attrNames cfg . bookmarks ) ;
157+ message = ''
158+ The keys of the `bookmarks` option should be integers between 0 and 9.
159+ '' ;
160+ } ;
163161
164162 extraConfigLua =
165163 let
Original file line number Diff line number Diff line change @@ -249,16 +249,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
249249 '' ;
250250 } ;
251251
252- assertions = [
253- {
254- assertion =
255- isBool cfg . settings . enable_persistent_history && cfg . settings . enable_persistent_history
256- -> config . plugins . sqlite-lua . enable ;
257- message = ''
258- Nixvim (plugins.neoclip): The persistent history sqlite storage backend needs `sqlite-lua` to function as intended.
259- You can enable it by setting `plugins.sqlite-lua.enable` to `true`.
260- '' ;
261- }
262- ] ;
252+ assertions = lib . nixvim . mkAssertions "plugins.neoclip" {
253+ assertion =
254+ isBool cfg . settings . enable_persistent_history && cfg . settings . enable_persistent_history
255+ -> config . plugins . sqlite-lua . enable ;
256+ message = ''
257+ The persistent history sqlite storage backend needs `sqlite-lua` to function as intended.
258+ You can enable it by setting `plugins.sqlite-lua.enable` to `true`.
259+ '' ;
260+ } ;
263261 } ;
264262}
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
111111 } ;
112112
113113 extraConfig = cfg : {
114- assertions =
114+ assertions = lib . nixvim . mkAssertions "plugins.neogit" (
115115 map
116116 ( name : {
117117 assertion =
@@ -121,14 +121,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
121121 in
122122 isEnabled -> config . plugins . ${ name } . enable ;
123123 message = ''
124- Nixvim (plugins.neogit): You have enabled the `${ name } ` integration, but `plugins.${ name } .enable` is `false`.
124+ You have enabled the `${ name } ` integration, but `plugins.${ name } .enable` is `false`.
125125 '' ;
126126 } )
127127 [
128128 "telescope"
129129 "diffview"
130130 "fzf-lua"
131- ] ;
131+ ]
132+ ) ;
132133
133134 extraPackages =
134135 [
Original file line number Diff line number Diff line change 119119 } // cfg . extraOptions ;
120120 in
121121 mkIf cfg . enable {
122- assertions = [
122+ assertions = lib . nixvim . mkAssertions "plugins.nvim-jdtls" [
123123 {
124124 assertion = cfg . cmd != null || cfg . data != null ;
125125 message = "You have to either set the `plugins.nvim-jdtls.data` or the `plugins.nvim-jdtls.cmd` option." ;
126126 }
127127 {
128128 assertion = cfg . cmd == null -> cfg . jdtLanguageServerPackage != null ;
129129 message = ''
130- Nixvim (plugins.nvim-jdtls) You haven't defined a `cmd` or `jdtLanguageServerPackage`.
130+ You haven't defined a `cmd` or `jdtLanguageServerPackage`.
131131
132132 The default `cmd` requires `plugins.nvim-jdtls.jdtLanguageServerPackage` to be set.
133133 '' ;
Original file line number Diff line number Diff line change @@ -108,14 +108,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
108108 } ;
109109
110110 extraConfig = cfg : {
111- assertions = [
112- {
113- assertion = cfg . enableTelescope -> config . plugins . telescope . enable ;
114- message = ''
115- Nixvim (plugins.package-info): The telescope integration needs telescope to function as intended.
116- '' ;
117- }
118- ] ;
111+ assertions = lib . nixvim . mkAssertions "plugins.package-info" {
112+ assertion = cfg . enableTelescope -> config . plugins . telescope . enable ;
113+ message = ''
114+ The telescope integration needs telescope to function as intended.
115+ '' ;
116+ } ;
119117
120118 extraPackages = [ cfg . packageManagerPackage ] ;
121119
Original file line number Diff line number Diff line change @@ -226,17 +226,17 @@ lib.nixvim.plugins.mkNeovimPlugin {
226226 callSetup = false ;
227227
228228 extraConfig = cfg : {
229- assertions = [
229+ assertions = lib . nixvim . mkAssertions "plugins.rest" [
230230 {
231231 assertion = config . plugins . treesitter . enable ;
232232 message = ''
233- Nixvim (plugins.rest): Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`.
233+ Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`.
234234 '' ;
235235 }
236236 {
237237 assertion = cfg . enableTelescope -> config . plugins . telescope . enable ;
238238 message = ''
239- Nixvim (plugins.rest): You have `plugins.rest.enableTelescope` set to true, but `plugins.telescope.enable` is false.
239+ You have `plugins.rest.enableTelescope` set to true, but `plugins.telescope.enable` is false.
240240 Either disable the telescope integration or enable telescope.
241241 '' ;
242242 }
Original file line number Diff line number Diff line change @@ -57,15 +57,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
5757
5858 globals . rustaceanvim = cfg . settings ;
5959
60- assertions = [
61- {
62- assertion = cfg . enable -> ! config . plugins . lsp . servers . rust_analyzer . enable ;
63- message = ''
64- Nixvim (plugins.rustaceanvim): Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust_analyzer.enable` are true.
65- Disable one of them otherwise you will have multiple clients attached to each buffer.
66- '' ;
67- }
68- ] ;
60+ assertions = lib . nixvim . mkAssertions "plugins.rustaceanvim" {
61+ assertion = cfg . enable -> ! config . plugins . lsp . servers . rust_analyzer . enable ;
62+ message = ''
63+ Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust_analyzer.enable` are true.
64+ Disable one of them otherwise you will have multiple clients attached to each buffer.
65+ '' ;
66+ } ;
6967
7068 # TODO: remove after 24.11
7169 warnings = lib . nixvim . mkWarnings "plugins.rustaceanvim" {
Original file line number Diff line number Diff line change 267267 sectionNames = attrNames cfg . sections ;
268268 numSections = length sectionNames ;
269269 in
270- [
270+ lib . nixvim . mkAssertions "plugins.startup" [
271271 {
272272 assertion = ( cfg . options . paddings == null ) || ( length cfg . options . paddings ) == numSections ;
273273 message = ''
274- Nixvim (plugins.startup): Make sure that `plugins.startup.options.paddings` has the same
274+ Make sure that `plugins.startup.options.paddings` has the same
275275 number of elements as there are sections.
276276 '' ;
277277 }
278278 {
279279 assertion =
280280 ( ( length cfg . parts ) <= numSections ) && ( all ( part : hasAttr part cfg . sections ) cfg . parts ) ;
281281 message = ''
282- Nixvim (plugins.startup): You should not have more section names in `plugins.startup.parts` than you have sections defined.
282+ You should not have more section names in `plugins.startup.parts` than you have sections defined.
283283 '' ;
284284 }
285285 ] ;
You can’t perform that action at this time.
0 commit comments