Closed srid closed 1 month ago
cc @roberth (have I correctly understood your templateGenerators
idea?)
Alternatively, if we don't care about being general enough, we could just pass om
configuration for templates as:
{
templates.default = { ... };
om.templates.default = {
params = {
# ...
};
};
}
This way, we don't have to fully spec out the general case first.
(Later, if a general spec does emerge, it should be straightforward to port the om.templates
configuration to it).
See #153 for configuration seen from larger context.
Regarding this, for MVP - let's keep the additional config in this repo, so it gives us some leeway to change things in future. Otherwise, we can consider this feature basically done.
Add
This should support a registry of flake templates (use our various
flake-parts
modules), initialize them usingnix flake init
as well as fill in any user-specific content using thetemplateGenerators
idea in flake-parts/templates#7 (comment)The goal is to have
om init
create flakes for any kind of stack, eventually.Implementation
To extend
flake.templates
, we can add:Here,
generator
can be an arbitrary derivation (a function that takespkgs
and returns atypes.package
?) or it can be a string that represents the command line to use to invoke the generator?om init
can fetch templates, and look for the special"om init"
generator, in which case it can short-circuit by calling the necessary internal initializer function, passing thetemplates.?.params
property as necessary.Tasks
flake.lock
explosion, by switching to a JSON registry? #190