feat(files): generate list of generated files dynamically

This commit is contained in:
Mohammad Rafiq 2025-07-03 07:38:05 +08:00
parent 1538745551
commit 68811a73d1
No known key found for this signature in database
2 changed files with 24 additions and 6 deletions

View file

@ -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 ];
perSystem = psArgs: {
make-shells.default.packages = [ psArgs.config.files.writer.drv ];
};
text.readme.parts.generated-files = ''
This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation.
The list of generated files are:
'';
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:"
]
++ (map mkListEntry listOfGeneratedFiles)
);
}