aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-builtin-constants.nix
diff options
context:
space:
mode:
authorBen Radford <benradf@users.noreply.github.com>2023-07-11 09:38:34 +0100
committerBen Radford <benradf@users.noreply.github.com>2023-07-11 09:38:34 +0100
commit25b20b4ad23d05d9a1e9daf105d33b7b68e4435b (patch)
tree18a5255ce272403ccfd34ab0aaad7135aed50a02 /doc/manual/generate-builtin-constants.nix
parent754ced4a3f6d3d8865ba78a2e503776d7bd6c04f (diff)
parent4a880c3cc085841a1537040405bc142fefffd7ff (diff)
Merge remote-tracking branch 'origin/master' into best-effort-supplementary-groups
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))