nixosOptionsDoc: add markdown formatting
This commit is contained in:
parent
7289645071
commit
d12aba5406
1 changed files with 26 additions and 0 deletions
|
@ -126,11 +126,37 @@ let
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
singleMDDoc = name: value: ''
|
||||||
|
## ${lib.escape [ "<" ">" ] name}
|
||||||
|
${value.description}
|
||||||
|
|
||||||
|
${lib.optionalString (value ? type) ''
|
||||||
|
*_Type_*:
|
||||||
|
${value.type}
|
||||||
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString (value ? default) ''
|
||||||
|
*_Default_*
|
||||||
|
```
|
||||||
|
${builtins.toJSON value.default}
|
||||||
|
```
|
||||||
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString (value ? example) ''
|
||||||
|
*_Example_*
|
||||||
|
```
|
||||||
|
${builtins.toJSON value.example}
|
||||||
|
```
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
|
||||||
in {
|
in {
|
||||||
inherit optionsNix;
|
inherit optionsNix;
|
||||||
|
|
||||||
optionsAsciiDoc = lib.concatStringsSep "\n" (lib.mapAttrsToList singleAsciiDoc optionsNix);
|
optionsAsciiDoc = lib.concatStringsSep "\n" (lib.mapAttrsToList singleAsciiDoc optionsNix);
|
||||||
|
|
||||||
|
optionsMDDoc = lib.concatStringsSep "\n" (lib.mapAttrsToList singleMDDoc optionsNix);
|
||||||
|
|
||||||
optionsJSON = pkgs.runCommand "options.json"
|
optionsJSON = pkgs.runCommand "options.json"
|
||||||
{ meta.description = "List of NixOS options in JSON format";
|
{ meta.description = "List of NixOS options in JSON format";
|
||||||
buildInputs = [ pkgs.brotli ];
|
buildInputs = [ pkgs.brotli ];
|
||||||
|
|
Loading…
Reference in a new issue