Skip to content

Commit 209facc

Browse files
committed
modules/docs: add various options pages
- options (root) - plugins - colorschemes - docs
1 parent 33d693e commit 209facc

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

modules/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
./performance.nix
2424
./plugins.nix
2525
];
26+
27+
docs.optionPages.options = {
28+
enable = true;
29+
optionScopes = [ ];
30+
};
2631
}

modules/docs/default.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@ in
3333
menu.location = [ "Contributing" ];
3434
source = fixLinks ../../CONTRIBUTING.md;
3535
};
36+
optionPages.docs = {
37+
optionScopes = [ "docs" ];
38+
page.menu.location = [ "docs" ];
39+
page.text = ''
40+
Internal options used to construct these docs.
41+
'';
42+
};
3643
};
3744
}

modules/plugins.nix

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{ lib, ... }:
1+
{ lib, options, ... }:
22
let
33
inherit (builtins) readDir;
4-
inherit (lib.attrsets) foldlAttrs;
4+
inherit (lib.attrsets) foldlAttrs mapAttrs';
55
inherit (lib.lists) optional;
66
by-name = ../plugins/by-name;
77
in
@@ -12,4 +12,37 @@ in
1212
prev: name: type:
1313
prev ++ optional (type == "directory") (by-name + "/${name}")
1414
) [ ] (readDir by-name);
15+
16+
docs.optionPages =
17+
let
18+
mkPluginPages =
19+
scope:
20+
mapAttrs' (
21+
name: _:
22+
let
23+
loc = [
24+
scope
25+
name
26+
];
27+
in
28+
{
29+
name = lib.concatStringsSep "/" loc;
30+
value = {
31+
optionScopes = loc;
32+
};
33+
}
34+
) options.${scope};
35+
in
36+
{
37+
colorschemes = {
38+
enable = true;
39+
optionScopes = [ "colorschemes" ];
40+
};
41+
plugins = {
42+
enable = true;
43+
optionScopes = [ "plugins" ];
44+
};
45+
}
46+
// mkPluginPages "plugins"
47+
// mkPluginPages "colorschemes";
1548
}

0 commit comments

Comments
 (0)