diff --git a/README.md b/README.md index 52721cd..65f57a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation. The list of generated files are: - +- [README.md](README.md) The option `text. 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..order`, or can itself have the attributes order and parts, in which case it will be evaluated recursively. \ No newline at end of file diff --git a/modules/flake-parts/files.nix b/modules/flake-parts/files.nix index d4b944b..3fcdd64 100644 --- a/modules/flake-parts/files.nix +++ b/modules/flake-parts/files.nix @@ -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) + ); }