aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-builtin-constants.nix
diff options
context:
space:
mode:
Diffstat (limited to 'doc/manual/generate-builtin-constants.nix')
-rw-r--r--doc/manual/generate-builtin-constants.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/manual/generate-builtin-constants.nix b/doc/manual/generate-builtin-constants.nix
new file mode 100644
index 000000000..3fc1fae42
--- /dev/null
+++ b/doc/manual/generate-builtin-constants.nix
@@ -0,0 +1,29 @@
+let
+ inherit (builtins) concatStringsSep attrValues mapAttrs;
+ inherit (import ./utils.nix) optionalString squash;
+in
+
+builtinsInfo:
+let
+ showBuiltin = name: { doc, type, impure-only }:
+ let
+ type' = optionalString (type != null) " (${type})";
+
+ impureNotice = optionalString impure-only ''
+ Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval).
+ '';
+ in
+ squash ''
+ <dt id="builtin-constants-${name}">
+ <a href="#builtin-constants-${name}"><code>${name}</code>${type'}</a>
+ </dt>
+ <dd>
+
+ ${doc}
+
+ ${impureNotice}
+
+ </dd>
+ '';
+in
+concatStringsSep "\n" (attrValues (mapAttrs showBuiltin builtinsInfo))