mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
21520297da
Because the manual is generated from default values which are themselves generated from various sources (cpuid, bios settings (kvm), number of cores). This commit hides non-reproducible settings from the manual output.
28 lines
1,012 B
Nix
28 lines
1,012 B
Nix
with builtins;
|
|
with import ./utils.nix;
|
|
|
|
options:
|
|
|
|
concatStrings (map
|
|
(name:
|
|
let option = options.${name}; in
|
|
" - `${name}` \n\n"
|
|
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
|
|
+ (if option.documentDefault
|
|
then " **Default:** " + (
|
|
if option.value == "" || option.value == []
|
|
then "*empty*"
|
|
else if isBool option.value
|
|
then (if option.value then "`true`" else "`false`")
|
|
else
|
|
# n.b. a StringMap value type is specified as a string, but
|
|
# this shows the value type. The empty stringmap is "null" in
|
|
# JSON, but that converts to "{ }" here.
|
|
(if isAttrs option.value then "`\"\"`"
|
|
else "`" + toString option.value + "`")) + "\n\n"
|
|
else " **Default:** *machine-specific*")
|
|
+ (if option.aliases != []
|
|
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
|
else "")
|
|
)
|
|
(attrNames options))
|