1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
nix/doc/manual/generate-store-info.nix
Valentin Gagarin ac5f147afc fix nix help-stores
the crash when calling `nix help-stores` was probably introduced an
artifact from a prior untangling of merge conflicts.
that said, `nix help-stores` should eventually cease to exist in favor
of dedicated `--help` outputs and `man` pages for the various store
types.
2024-03-03 22:38:00 +01:00

46 lines
1.2 KiB
Nix

let
inherit (builtins) attrValues mapAttrs;
inherit (import <nix/utils.nix>) concatStrings optionalString;
showSettings = import <nix/generate-settings.nix>;
in
inlineHTML: storesInfo:
let
showStore = name: { settings, doc, experimentalFeature }:
let
result = ''
## ${name}
${doc}
${experimentalFeatureNote}
### Settings
${showSettings { prefix = "store-${slug}"; inherit inlineHTML; } settings}
'';
# markdown doesn't like spaces in URLs
slug = builtins.replaceStrings [ " " ] [ "-" ] name;
experimentalFeatureNote = optionalString (experimentalFeature != null) ''
> **Warning**
> This store is part of an
> [experimental feature](@docroot@/contributing/experimental-features.md).
To use this store, you need to make sure the corresponding experimental feature,
[`${experimentalFeature}`](@docroot@/contributing/experimental-features.md#xp-feature-${experimentalFeature}),
is enabled.
For example, include the following in [`nix.conf`](#):
```
extra-experimental-features = ${experimentalFeature}
```
'';
in result;
in concatStrings (attrValues (mapAttrs showStore storesInfo))