mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
660c19eb49
For each `nix.conf` option, add an empty html node with a unique `id` that can be used as an anchor target. Also make the name of the option be a link to that target so that it’s easily discoverable. We can’t rewrite the whole list as an html definition list like it’s done for the builtins because these options also appear in a man page, and the manpage renderer (lowdown) can’t render arbitrary html. But the hack here allows to keep the manpage and have the links in the html version. Fix https://github.com/NixOS/nix/issues/5745
29 lines
1 KiB
Nix
29 lines
1 KiB
Nix
with builtins;
|
|
with import ./utils.nix;
|
|
|
|
options:
|
|
|
|
concatStrings (map
|
|
(name:
|
|
let option = options.${name}; in
|
|
" - [`${name}`](#conf-${name})"
|
|
+ "<p id=\"conf-${name}\"></p>\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*\n")
|
|
+ (if option.aliases != []
|
|
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
|
else "")
|
|
)
|
|
(attrNames options))
|