aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-builtin-constants.nix
blob: 8af80a02ca1edae1a495386e889605b39732974a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 ''
        > **Note**
        >
        > Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval).
      '';
    in
    squash ''
      <dt id="builtins-${name}">
        <a href="#builtins-${name}"><code>${name}</code></a>${type'}
      </dt>
      <dd>

      ${doc}

      ${impureNotice}

      </dd>
    '';
in
concatStringsSep "\n" (attrValues (mapAttrs showBuiltin builtinsInfo))