|
171 | 171 | }; |
172 | 172 | clippy = mkOption { |
173 | 173 | description = lib.mdDoc "clippy hook"; |
174 | | - type = types.submodule { |
175 | | - imports = [ hookModule ]; |
176 | | - options.packageOverrides = { |
177 | | - cargo = mkOption { |
178 | | - type = types.package; |
179 | | - description = lib.mdDoc "The cargo package to use"; |
180 | | - }; |
181 | | - clippy = mkOption { |
182 | | - type = types.package; |
183 | | - description = lib.mdDoc "The clippy package to use"; |
184 | | - }; |
185 | | - }; |
186 | | - options.settings = { |
187 | | - denyWarnings = mkOption { |
188 | | - type = types.bool; |
189 | | - description = lib.mdDoc "Fail when warnings are present"; |
190 | | - default = false; |
191 | | - }; |
192 | | - offline = mkOption { |
193 | | - type = types.bool; |
194 | | - description = lib.mdDoc "Run clippy offline"; |
195 | | - default = true; |
| 174 | + type = types.submodule |
| 175 | + ({ config, ... }: { |
| 176 | + imports = [ hookModule ]; |
| 177 | + options.packageOverrides = { |
| 178 | + cargo = mkOption { |
| 179 | + type = types.package; |
| 180 | + description = lib.mdDoc "The cargo package to use"; |
| 181 | + }; |
| 182 | + clippy = mkOption { |
| 183 | + type = types.package; |
| 184 | + description = lib.mdDoc "The clippy package to use"; |
| 185 | + }; |
196 | 186 | }; |
197 | | - allFeatures = mkOption { |
198 | | - type = types.bool; |
199 | | - description = lib.mdDoc "Run clippy with --all-features"; |
200 | | - default = false; |
| 187 | + options.settings = { |
| 188 | + denyWarnings = mkOption { |
| 189 | + type = types.bool; |
| 190 | + description = lib.mdDoc "Fail when warnings are present"; |
| 191 | + default = false; |
| 192 | + }; |
| 193 | + offline = mkOption { |
| 194 | + type = types.bool; |
| 195 | + description = lib.mdDoc "Run clippy offline"; |
| 196 | + default = true; |
| 197 | + }; |
| 198 | + allFeatures = mkOption { |
| 199 | + type = types.bool; |
| 200 | + description = lib.mdDoc "Run clippy with --all-features"; |
| 201 | + default = false; |
| 202 | + }; |
201 | 203 | }; |
202 | | - }; |
203 | | - }; |
| 204 | + |
| 205 | + config.extraPackages = [ |
| 206 | + config.packageOverrides.cargo |
| 207 | + config.packageOverrides.clippy |
| 208 | + ]; |
| 209 | + }); |
204 | 210 | }; |
205 | 211 | cmake-format = mkOption { |
206 | 212 | description = lib.mdDoc "cmake-format hook"; |
|
333 | 339 | }; |
334 | 340 | dune-fmt = mkOption { |
335 | 341 | description = lib.mdDoc "dune-fmt hook"; |
336 | | - type = types.submodule { |
337 | | - imports = [ hookModule ]; |
338 | | - options.settings = { |
339 | | - auto-promote = |
340 | | - mkOption { |
341 | | - type = types.bool; |
342 | | - description = lib.mdDoc "Whether to auto-promote the changes."; |
343 | | - default = true; |
344 | | - }; |
| 342 | + type = types.submodule |
| 343 | + ({ config, ... }: { |
| 344 | + imports = [ hookModule ]; |
| 345 | + options.settings = { |
| 346 | + auto-promote = |
| 347 | + mkOption { |
| 348 | + type = types.bool; |
| 349 | + description = lib.mdDoc "Whether to auto-promote the changes."; |
| 350 | + default = true; |
| 351 | + }; |
| 352 | + |
| 353 | + extraRuntimeInputs = |
| 354 | + mkOption { |
| 355 | + type = types.listOf types.package; |
| 356 | + description = lib.mdDoc "Extra runtimeInputs to add to the environment, eg. `ocamlformat`."; |
| 357 | + default = [ ]; |
| 358 | + }; |
| 359 | + }; |
345 | 360 |
|
346 | | - extraRuntimeInputs = |
347 | | - mkOption { |
348 | | - type = types.listOf types.package; |
349 | | - description = lib.mdDoc "Extra runtimeInputs to add to the environment, eg. `ocamlformat`."; |
350 | | - default = [ ]; |
351 | | - }; |
352 | | - }; |
353 | | - }; |
| 361 | + config.extraPackages = config.settings.extraRuntimeInputs; |
| 362 | + }); |
354 | 363 | }; |
355 | 364 | eclint = mkOption { |
356 | 365 | description = lib.mdDoc "eclint hook"; |
@@ -1324,19 +1333,25 @@ in |
1324 | 1333 | hooks.rustfmt.packageOverrides.rustfmt = pkgs.rustfmt; |
1325 | 1334 | ``` |
1326 | 1335 | ''; |
1327 | | - type = types.submodule { |
1328 | | - imports = [ hookModule ]; |
1329 | | - options.packageOverrides = { |
1330 | | - cargo = mkOption { |
1331 | | - type = types.package; |
1332 | | - description = lib.mdDoc "The cargo package to use."; |
1333 | | - }; |
1334 | | - rustfmt = mkOption { |
1335 | | - type = types.package; |
1336 | | - description = lib.mdDoc "The rustfmt package to use."; |
| 1336 | + type = types.submodule |
| 1337 | + ({ config, ... }: { |
| 1338 | + imports = [ hookModule ]; |
| 1339 | + options.packageOverrides = { |
| 1340 | + cargo = mkOption { |
| 1341 | + type = types.package; |
| 1342 | + description = lib.mdDoc "The cargo package to use."; |
| 1343 | + }; |
| 1344 | + rustfmt = mkOption { |
| 1345 | + type = types.package; |
| 1346 | + description = lib.mdDoc "The rustfmt package to use."; |
| 1347 | + }; |
1337 | 1348 | }; |
1338 | | - }; |
1339 | | - }; |
| 1349 | + |
| 1350 | + config.extraPackages = [ |
| 1351 | + config.packageOverrides.cargo |
| 1352 | + config.packageOverrides.rustfmt |
| 1353 | + ]; |
| 1354 | + }); |
1340 | 1355 | }; |
1341 | 1356 | statix = mkOption { |
1342 | 1357 | description = lib.mdDoc "statix hook"; |
@@ -1399,22 +1414,26 @@ in |
1399 | 1414 | hooks.treefmt.packageOverrides.treefmt = pkgs.treefmt; |
1400 | 1415 | ``` |
1401 | 1416 | ''; |
1402 | | - type = types.submodule { |
1403 | | - imports = [ hookModule ]; |
1404 | | - options.packageOverrides = { |
1405 | | - treefmt = mkOption { |
1406 | | - type = types.package; |
1407 | | - description = lib.mdDoc "The treefmt package to use"; |
1408 | | - }; |
1409 | | - }; |
1410 | | - options.settings = { |
1411 | | - formatters = mkOption { |
1412 | | - type = types.listOf types.package; |
1413 | | - description = lib.mdDoc "The formatter packages configured by treefmt"; |
1414 | | - default = [ ]; |
1415 | | - }; |
1416 | | - }; |
1417 | | - }; |
| 1417 | + type = types.submodule |
| 1418 | + ({ config, ... }: |
| 1419 | + { |
| 1420 | + imports = [ hookModule ]; |
| 1421 | + options.packageOverrides = { |
| 1422 | + treefmt = mkOption { |
| 1423 | + type = types.package; |
| 1424 | + description = lib.mdDoc "The treefmt package to use"; |
| 1425 | + }; |
| 1426 | + }; |
| 1427 | + options.settings = { |
| 1428 | + formatters = mkOption { |
| 1429 | + type = types.listOf types.package; |
| 1430 | + description = lib.mdDoc "The formatter packages configured by treefmt"; |
| 1431 | + default = [ ]; |
| 1432 | + }; |
| 1433 | + }; |
| 1434 | + |
| 1435 | + config.extraPackages = config.settings.formatters; |
| 1436 | + }); |
1418 | 1437 | }; |
1419 | 1438 | typos = mkOption { |
1420 | 1439 | description = lib.mdDoc "typos hook"; |
|
0 commit comments