diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix index 1e7abf36535..ba0f9a5b890 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -227,4 +227,19 @@ rec { }; + mkMultiInstance = path: args: f: + let + def = f (args // { name = "default"; config = getAttrFromPath path args.config; }); + in { + options = setAttrByPath path (def.options // { + instances = mkOption { + type = types.attrsOf (types.submodule f); + default = {}; + description = "Additional instances of this service"; + }; + }); + + config = def.config; + }; + } |