AFAIU flake templates create a directory hierarchy by simply copying the contents of the template’s directory.
Is there any way to
- share content between multiple templates in the same flake, without having to
cpit into each template’s directory? For example, I want a bunch of templates which are variations on a theme. Much of the code in them will be identical. If I fix a bug in this shared code, it needs to be fixed in all the templates. How can I have a single source of truth for such cases?
- have the template generate the content by filling in some gaps. For example, I want templates which generate a new project for a client. Instead of giving the client a list of places where dummy values need to be replaced with project-specific values, I would like the template to generate the files with the project-specific values already in place, taken from information provided by the user at the time the template is used.
I can probably hack together some home-grown scripts to mitigate the amount of repetitive and error-prone work that needs to be done in these cases, but I’d rather not re-invent any wheels.
Does anything exist to help with cases such as these?