mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
3c200da242
* document `fetchTree` * display experimental feature note at the top we have to enable the new `fetchTree` experimental feature to render it at all. this was a bug introduced when adding that new feature flag. Co-authored-by: tomberek <tomberek@users.noreply.github.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Silvan Mosberger <github@infinisil.com>
57 lines
1.6 KiB
Nix
57 lines
1.6 KiB
Nix
let
|
|
inherit (builtins) attrNames listToAttrs concatStringsSep readFile replaceStrings;
|
|
inherit (import <nix/utils.nix>) optionalString filterAttrs trim squash toLower unique indent;
|
|
showSettings = import <nix/generate-settings.nix>;
|
|
in
|
|
|
|
{
|
|
# data structure describing all stores and their parameters
|
|
storeInfo,
|
|
# whether to add inline HTML tags
|
|
# `lowdown` does not eat those for one of the output modes
|
|
inlineHTML,
|
|
}:
|
|
|
|
let
|
|
|
|
showStore = { name, slug }: { settings, doc, experimentalFeature }:
|
|
let
|
|
result = squash ''
|
|
# ${name}
|
|
|
|
${experimentalFeatureNote}
|
|
|
|
${doc}
|
|
|
|
## Settings
|
|
|
|
${showSettings { prefix = "store-${slug}"; inherit inlineHTML; } settings}
|
|
'';
|
|
|
|
experimentalFeatureNote = optionalString (experimentalFeature != null) ''
|
|
> **Warning**
|
|
>
|
|
> This store is part of an
|
|
> [experimental feature](@docroot@/contributing/experimental-features.md).
|
|
>
|
|
> To use this store, make sure the
|
|
> [`${experimentalFeature}` experimental feature](@docroot@/contributing/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}
|
|
> ```
|
|
'';
|
|
in result;
|
|
|
|
storesList = map
|
|
(name: rec {
|
|
inherit name;
|
|
slug = replaceStrings [ " " ] [ "-" ] (toLower name);
|
|
filename = "${slug}.md";
|
|
page = showStore { inherit name slug; } storeInfo.${name};
|
|
})
|
|
(attrNames storeInfo);
|
|
|
|
in storesList
|