Skip to content

Commit 1166016

Browse files
authored
ci(docgen): more progress towards release of docgen api (#287)
also added _file and key as things can be overridden about the makeWrapper module in case it looks better in the docs that way for a particular module (might be useful for the neovim hosts options)
1 parent 5ad52c5 commit 1166016

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

ci/checks/all-modules-have-maintainers.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let
1010
name:
1111
let
1212
module = module_set.${name};
13-
list = (self.lib.evalModule module).config.meta.maintainers;
13+
list = (self.lib.evalModule module).options.meta.maintainers.definitionsWithLocations;
1414
check = modpath: pkgs.lib.findFirst (v: toString v.file == toString modpath) null list == null;
1515
in
1616
if !pkgs.lib.isStringLike module then false else check module

ci/docs/per-mod/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ rec {
5252
options,
5353
transform ? null,
5454
includeCore ? true,
55+
prefix ? false,
5556
...
5657
}:
5758
lib.pipe
@@ -60,6 +61,7 @@ rec {
6061
options
6162
includeCore
6263
transform
64+
prefix
6365
;
6466
}
6567
[

ci/docs/per-mod/normopts.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
}:
66
{
77
options,
8-
prefix ? null,
8+
prefix ? false,
99
transform ? null,
1010
includeCore ? true,
1111
...
@@ -15,7 +15,7 @@ let
1515
options.extendModules.value or (
1616
_: throw "nix-wrapper-modules docgen error: the options set passed was not from a wrapper module!"
1717
)
18-
{ ${if prefix != null then "prefix" else null} = prefix; };
18+
{ ${if prefix == null || builtins.isList prefix then "prefix" else null} = prefix; };
1919
in
2020
let
2121
inherit (evaluated) options graph;

ci/docs/per-mod/rendermd.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
options,
1111
includeCore ? true,
1212
transform ? null,
13+
prefix ? false,
1314
nameFromModule ?
1415
{ file, ... }:
1516
lib.removeSuffix "/module.nix" (lib.removePrefix "${wlib.modulesPath}/" (toString file)),
@@ -49,6 +50,7 @@ let
4950
inherit
5051
options
5152
transform
53+
prefix
5254
includeCore
5355
;
5456
});

lib/lib.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ in
197197
options = lib.setAttrByPath (optloc ++ [ name ]) (
198198
lib.mkOption {
199199
default = { };
200+
description = ''
201+
wrapper module for `${name}` as a submodule option
202+
'';
200203
type = wlib.types.subWrapperModule (
201204
(lib.toList value)
202205
++ [

modules/makeWrapper/module.nix

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let
22
options_module =
3-
excluded: is_top:
3+
_file: excluded: is_top:
44
{
55
config,
66
options,
@@ -11,7 +11,7 @@ let
1111
...
1212
}:
1313
{
14-
_file = ./module.nix;
14+
inherit _file;
1515
options.${if !(excluded.argv0type or false) then "argv0type" else null} = lib.mkOption {
1616
type =
1717
with lib.types;
@@ -470,10 +470,11 @@ let
470470
inherit wlib;
471471
};
472472
modules = [
473-
(options_module excluded false)
473+
(options_module _file excluded false)
474474
(
475475
{ name, ... }:
476476
{
477+
inherit _file;
477478
options.enable = lib.mkOption {
478479
type = lib.types.bool;
479480
default = true;
@@ -573,6 +574,8 @@ in
573574
excluded_options = { };
574575
exclude_wrapper = false;
575576
exclude_meta = false;
577+
_file = ./module.nix;
578+
key = ./module.nix;
576579
__functor =
577580
self:
578581
{
@@ -581,9 +584,9 @@ in
581584
...
582585
}:
583586
{
584-
_file = ./module.nix;
585-
key = ./module.nix;
586-
imports = [ (options_module (self.excluded_options or { }) true) ];
587+
_file = self._file or ./module.nix;
588+
${if (self.key or ./module.nix) != null then "key" else null} = self.key or ./module.nix;
589+
imports = [ (options_module (self._file or ./module.nix) (self.excluded_options or { }) true) ];
587590
config.${if self.exclude_wrapper or false then null else "wrapperFunction"} = lib.mkDefault (
588591
self.wrapperFunction or (import ./. null)
589592
);
@@ -648,6 +651,8 @@ in
648651
`excluded_options = { ... };` where you may include `optionname = true`
649652
in order to not define that option.
650653
654+
`_file` and `key`: `_file` changes the value set for the modules imported when you import this module. `key` is set on the main one if not `null`.
655+
651656
In order to change these values, you change them in the set before importing the module like so:
652657
653658
```nix

0 commit comments

Comments
 (0)