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
|
|
|
${experimentalFeatureNote}
|
2023-09-06 22:31:33 +00:00
|
|
|
|
2023-12-10 05:16:32 +00:00
|
|
|
${doc}
|
|
|
|
|
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
|
2024-07-25 02:53:06 +00:00
|
|
|
> [experimental feature](@docroot@/development/experimental-features.md).
|
2023-11-30 20:59:08 +00:00
|
|
|
>
|
|
|
|
> To use this store, make sure the
|
2024-07-25 02:53:06 +00:00
|
|
|
> [`${experimentalFeature}` experimental feature](@docroot@/development/experimental-features.md#xp-feature-${experimentalFeature})
|
2023-11-30 20:59:08 +00:00
|
|
|
> 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
|