File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 16
16
./menu
17
17
./option-pages
18
18
./pages.nix
19
+ ./platforms.nix
19
20
./user-guide
20
21
] ;
21
22
Original file line number Diff line number Diff line change 172
172
} ;
173
173
} ;
174
174
config . docs = {
175
+ _utils = {
176
+ inherit optionsPageModule ;
177
+ } ;
175
178
# Define pages for each "optionPages" attr
176
179
pages = lib . pipe config . docs . optionPages [
177
180
( lib . filterAttrs ( _ : v : v . enable ) )
Original file line number Diff line number Diff line change
1
+ {
2
+ lib ,
3
+ config ,
4
+ pkgs ,
5
+ ...
6
+ } :
7
+ let
8
+ inherit ( config . docs . _utils )
9
+ optionsPageModule
10
+ mkOptionList
11
+ ;
12
+
13
+ evalModule =
14
+ module :
15
+ lib . evalModules {
16
+ modules = [
17
+ module
18
+ { _module . check = false ; }
19
+ { _module . args . pkgs = lib . mkForce pkgs ; }
20
+ ] ;
21
+ } ;
22
+
23
+ platformPageType = lib . types . submodule (
24
+ { config , ... } :
25
+ {
26
+ imports = [
27
+ optionsPageModule
28
+ ] ;
29
+ options = {
30
+ module = lib . mkOption {
31
+ type = lib . types . deferredModule ;
32
+ description = ''
33
+ A module defining platform-specific options.
34
+ '' ;
35
+ } ;
36
+ } ;
37
+ config = {
38
+ optionsList = lib . pipe config . module [
39
+ evalModule
40
+ ( lib . getAttr "options" )
41
+ mkOptionList
42
+ ] ;
43
+ page . menu . section = lib . mkDefault "platforms" ;
44
+ } ;
45
+ }
46
+ ) ;
47
+ in
48
+ {
49
+ options . docs = {
50
+ platformPages = lib . mkOption {
51
+ type = with lib . types ; lazyAttrsOf platformPageType ;
52
+ description = ''
53
+ A set of platform pages to include in the docs.
54
+
55
+ Each enabled platform page will produce a corresponding `pages` page.
56
+ '' ;
57
+ default = { } ;
58
+ } ;
59
+ } ;
60
+
61
+ # Define pages for each "platformPages" attr
62
+ config . docs . pages = lib . pipe config . docs . platformPages [
63
+ ( lib . filterAttrs ( _ : v : v . enable ) )
64
+ ( builtins . mapAttrs ( _ : cfg : cfg . page ) )
65
+ ] ;
66
+ }
You can’t perform that action at this time.
0 commit comments