2023-09-06 22:31:33 +00:00
|
|
|
let
|
2023-11-30 22:07:09 +00:00
|
|
|
inherit (builtins) attrNames listToAttrs concatStringsSep readFile replaceStrings;
|
|
|
|
inherit (import <nix/utils.nix>) optionalString filterAttrs trim squash toLower unique indent;
|
2023-11-30 20:41:47 +00:00
|
|
|
showSettings = import <nix/generate-settings.nix>;
|
2023-09-06 22:31:33 +00:00
|
|
|
in
|
|
|
|
|
2023-11-30 22:07:09 +00:00
|
|
|
{
|
|
|
|
# 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,
|
|
|
|
}:
|
2023-09-06 22:31:33 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-11-30 22:07:09 +00:00
|
|
|
showStore = { name, slug }: { settings, doc, experimentalFeature }:
|
2023-09-06 22:31:33 +00:00
|
|
|
let
|
2023-11-30 20:59:08 +00:00
|
|
|
result = squash ''
|
|
|
|
# ${name}
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 20:59:08 +00:00
|
|
|
${doc}
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 20:59:08 +00:00
|
|
|
${experimentalFeatureNote}
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 20:59:08 +00:00
|
|
|
## Settings
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 20:59:08 +00:00
|
|
|
${showSettings { prefix = "store-${slug}"; inherit inlineHTML; } settings}
|
|
|
|
'';
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 20:59:08 +00:00
|
|
|
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;
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-11-30 22:07:09 +00:00
|
|
|
storesList = map
|
|
|
|
(name: rec {
|
|
|
|
inherit name;
|
|
|
|
slug = replaceStrings [ " " ] [ "-" ] (toLower name);
|
|
|
|
filename = "${slug}.md";
|
|
|
|
page = showStore { inherit name slug; } storeInfo.${name};
|
|
|
|
})
|
|
|
|
(attrNames storeInfo);
|
|
|
|
|
|
|
|
in storesList
|