File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 14
14
./mdbook
15
15
./menu
16
16
./pages.nix
17
+ ./user-guide
17
18
] ;
18
19
19
20
config . docs = {
Original file line number Diff line number Diff line change
1
+ {
2
+ lib ,
3
+ pkgs ,
4
+ ...
5
+ } :
6
+ let
7
+ user-guide = ../../../docs/user-guide ;
8
+
9
+ sourceTransformers = {
10
+ config-examples =
11
+ template :
12
+ pkgs . callPackage ./user-configs.nix {
13
+ inherit template ;
14
+ } ;
15
+ } ;
16
+ in
17
+ {
18
+ docs . pages = lib . concatMapAttrs (
19
+ name : type :
20
+ let
21
+ title = lib . removeSuffix ".md" name ;
22
+ transformer = sourceTransformers . ${ title } or lib . id ;
23
+ in
24
+ lib . optionalAttrs ( type == "regular" ) {
25
+ "user-guide/${ title } " = {
26
+ menu . section = "user-guide" ;
27
+ # TODO: define user-facing titles to show in the menu...
28
+ menu . location = [ title ] ;
29
+ source = transformer "${ user-guide } /${ name } " ;
30
+ } ;
31
+ }
32
+ ) ( builtins . readDir user-guide ) ;
33
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ runCommand ,
3
+ callPackage ,
4
+ template ,
5
+ } :
6
+ runCommand "user-configs.md"
7
+ {
8
+ inherit template ;
9
+ user_configs = callPackage ../../../docs/user-configs { } ;
10
+ }
11
+ ''
12
+ substitute $template $out \
13
+ --subst-var-by USER_CONFIGS "$(cat $user_configs)"
14
+ ''
You can’t perform that action at this time.
0 commit comments