Implement a interface-like system
Opened this issue · 2 comments
Some options are commonly shared between different services. For example:
{
# ...
envsubst = {
enable = mkEnableOption "Enable envsubst";
variables = mkOption {
type = with types; attrsOf (oneOf [ string int bool ]);
# ...
};
};
# ...
}
These options should be available for all services, but they should be implemented differently, each service has different config files. The next step may be making a system where the environmental substitution of configuration files is delegated to a common implementation, so that one can rely on original config files being in /run/<service-name>/orig
and the modified version being in /run/<service-name>/subst
.
Another example may be "user-group" handling, almost all services have a user
and group
options. The semantics of these options are not well defined, while I personally try to adhere to some semantics, it would be best if this was formalized in an implementation external to individual modules.
I think the common interface can be implemented in lib.types.deferredModule
since NixOS/nixpkgs#163617
Indeed, the problem is deciding what to make default and precisely how it should work :) but thanks for the pointer deferredSubmodule
will be useful for another thing im working on. I didn't know abiut that type somehow.