mirror of
https://github.com/NixOS/nix.git
synced 2024-11-28 09:42:29 +00:00
a2fed6db9e
* manual: Contributing -> Development, Hacking -> Building what's currently called "hacking" are really instructions for setting up a development environment and compiling from source. we have a contribution guide in the repo (which rightly focuses on GitHub workflows), and the material in the manual is more about working on the code itself. since we'd otherwise have three headings that amount to "Building Nix", this change also moves the "classic Nix" instructions to the top. we may want to reorganise this in the future, and bring contributor-oriented information closer to the code, but for now let's stick to more accurate names to ease navigation.
68 lines
2.4 KiB
Nix
68 lines
2.4 KiB
Nix
let
|
|
inherit (builtins) attrValues concatStringsSep isAttrs isBool mapAttrs;
|
|
inherit (import <nix/utils.nix>) concatStrings indent optionalString squash;
|
|
in
|
|
|
|
# `inlineHTML` is a hack to accommodate inconsistent output from `lowdown`
|
|
{ prefix, inlineHTML ? true }: settingsInfo:
|
|
|
|
let
|
|
|
|
showSetting = prefix: setting: { description, documentDefault, defaultValue, aliases, value, experimentalFeature }:
|
|
let
|
|
result = squash ''
|
|
- ${item}
|
|
|
|
${indent " " body}
|
|
'';
|
|
item = if inlineHTML
|
|
then ''<span id="${prefix}-${setting}">[`${setting}`](#${prefix}-${setting})</span>''
|
|
else "`${setting}`";
|
|
# separate body to cleanly handle indentation
|
|
body = ''
|
|
${experimentalFeatureNote}
|
|
|
|
${description}
|
|
|
|
**Default:** ${showDefault documentDefault defaultValue}
|
|
|
|
${showAliases aliases}
|
|
'';
|
|
|
|
experimentalFeatureNote = optionalString (experimentalFeature != null) ''
|
|
> **Warning**
|
|
>
|
|
> This setting is part of an
|
|
> [experimental feature](@docroot@/development/experimental-features.md).
|
|
>
|
|
> To change this setting, make sure the
|
|
> [`${experimentalFeature}` experimental feature](@docroot@/development/experimental-features.md#xp-feature-${experimentalFeature})
|
|
> is enabled.
|
|
> For example, include the following in [`nix.conf`](@docroot@/command-ref/conf-file.md):
|
|
>
|
|
> ```
|
|
> extra-experimental-features = ${experimentalFeature}
|
|
> ${setting} = ...
|
|
> ```
|
|
'';
|
|
|
|
showDefault = documentDefault: defaultValue:
|
|
if documentDefault then
|
|
# 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 defaultValue == "" || defaultValue == [] || isAttrs defaultValue
|
|
then "*empty*"
|
|
else if isBool defaultValue then
|
|
if defaultValue then "`true`" else "`false`"
|
|
else "`${toString defaultValue}`"
|
|
else "*machine-specific*";
|
|
|
|
showAliases = aliases:
|
|
optionalString (aliases != [])
|
|
"**Deprecated alias:** ${(concatStringsSep ", " (map (s: "`${s}`") aliases))}";
|
|
|
|
in result;
|
|
|
|
in concatStrings (attrValues (mapAttrs (showSetting prefix) settingsInfo))
|