aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-options.nix
diff options
context:
space:
mode:
Diffstat (limited to 'doc/manual/generate-options.nix')
-rw-r--r--doc/manual/generate-options.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/manual/generate-options.nix b/doc/manual/generate-options.nix
new file mode 100644
index 000000000..3c31a4eec
--- /dev/null
+++ b/doc/manual/generate-options.nix
@@ -0,0 +1,26 @@
+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"
+ + " **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"
+ + (if option.aliases != []
+ then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
+ else "")
+ )
+ (attrNames options))