Closed Atry closed 1 year ago
Submodules also support the static merging of a module, so we should then also have mkSubmoduleOption
, although submodules tend not to appear as the type of an option, but rather as a type argument.
It would be nice if the module system could cast function syntax in options
to the right option type using the explicitly declared options. I feel like that's a lot to ask of the module system's already stretched syntax, but it is very ergonomic:
{
options.perSystem = { config, lib, system, ... }: {
# it's a module that's statically known, so has docs
};
}
{
options.services.nginx.virtualHosts = virtualHostName: { config, ... }: {
# a NixOS nginx plugin
# note that `attrsOf` already passes `"<name>"` for static purposes
};
}
Arguments against:
mkOption
.Arguments for:
mkDeferredModuleOption
.I think we should allow for merging an option with its default values, no matter what the type is.
I created #145 for now, as Nixpkgs right now has not yet supported directly declared bare deferred module.
Fixed in #145
mkPerSystemOption
barely creates an option of deferred module for documenting purpose. Shall we rename it tomkDeferredModuleOption
? Since it is general-purposed, shall we upstream it tonixpkgs
?