2023-09-07 01:31:33 +03:00
|
|
|
let
|
2023-12-01 00:07:09 +02:00
|
|
|
inherit (builtins) attrNames listToAttrs concatStringsSep readFile replaceStrings;
|
|
|
|
inherit (import <nix/utils.nix>) optionalString filterAttrs trim squash toLower unique indent;
|
2023-11-30 22:41:47 +02:00
|
|
|
showSettings = import <nix/generate-settings.nix>;
|
2023-09-07 01:31:33 +03:00
|
|
|
in
|
|
|
|
|
2023-12-01 00:07:09 +02: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-07 01:31:33 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-12-01 00:07:09 +02:00
|
|
|
showStore = { name, slug }: { settings, doc, experimentalFeature }:
|
2023-09-07 01:31:33 +03:00
|
|
|
let
|
2023-11-30 22:59:08 +02:00
|
|
|
result = squash ''
|
|
|
|
# ${name}
|
2023-09-07 01:31:33 +03:00
|
|
|
|
2023-11-30 22:59:08 +02:00
|
|
|
${experimentalFeatureNote}
|
2023-09-07 01:31:33 +03:00
|
|
|
|
2023-12-10 07:16:32 +02:00
|
|
|
${doc}
|
|
|
|
|
2023-11-30 22:59:08 +02:00
|
|
|
## Settings
|
2023-09-07 01:31:33 +03:00
|
|
|
|
2023-11-30 22:59:08 +02:00
|
|
|
${showSettings { prefix = "store-${slug}"; inherit inlineHTML; } settings}
|
|
|
|
'';
|
2023-09-07 01:31:33 +03:00
|
|
|
|
2023-11-30 22:59:08 +02:00
|
|
|
experimentalFeatureNote = optionalString (experimentalFeature != null) ''
|
|
|
|
> **Warning**
|
|
|
|
>
|
|
|
|
> This store is part of an
|
2024-07-25 05:53:06 +03:00
|
|
|
> [experimental feature](@docroot@/development/experimental-features.md).
|
2023-11-30 22:59:08 +02:00
|
|
|
>
|
|
|
|
> To use this store, make sure the
|
2024-07-25 05:53:06 +03:00
|
|
|
> [`${experimentalFeature}` experimental feature](@docroot@/development/experimental-features.md#xp-feature-${experimentalFeature})
|
2023-11-30 22:59:08 +02: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-07 01:31:33 +03:00
|
|
|
|
2023-12-01 00:07:09 +02: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
|