feat(files): generate list of generated files dynamically
This commit is contained in:
parent
63609ffa14
commit
6e7fc72d38
2 changed files with 24 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation.
|
This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation.
|
||||||
The list of generated files are:
|
The list of generated files are:
|
||||||
|
- [README.md](README.md)
|
||||||
The option `text.<name> supports either a string or a submodule with attributes order and parts. The parts attribute can either be a string, which will get concatenated in the order laid out in `text.<name>.order`, or can itself have the attributes order and parts, in which case it will be evaluated recursively.
|
The option `text.<name> supports either a string or a submodule with attributes order and parts. The parts attribute can either be a string, which will get concatenated in the order laid out in `text.<name>.order`, or can itself have the attributes order and parts, in which case it will be evaluated recursively.
|
|
@ -1,11 +1,29 @@
|
||||||
{ inputs, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
withSystem,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (builtins) map head;
|
||||||
|
inherit (lib) concatStringsSep;
|
||||||
|
#TODO: add the .nix file its generated from
|
||||||
|
mkListEntry = x: "- [" + x.path_ + "](" + x.path_ + ")";
|
||||||
|
listOfGeneratedFiles = withSystem (head config.systems) (psArgs: psArgs.config.files.files);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.files.flakeModules.default ];
|
imports = [ inputs.files.flakeModules.default ];
|
||||||
perSystem = psArgs: {
|
perSystem = psArgs: {
|
||||||
make-shells.default.packages = [ psArgs.config.files.writer.drv ];
|
make-shells.default.packages = [ psArgs.config.files.writer.drv ];
|
||||||
};
|
};
|
||||||
text.readme.parts.generated-files = ''
|
text.readme.parts.generated-files = concatStringsSep "\n" (
|
||||||
This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation.
|
[
|
||||||
The list of generated files are:
|
"This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation."
|
||||||
'';
|
|
||||||
|
"The list of generated files are:"
|
||||||
|
|
||||||
|
]
|
||||||
|
++ (map mkListEntry listOfGeneratedFiles)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue