summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorLuca Bruno <lucabru@src.gnome.org>2015-03-13 14:11:59 +0000
committerLuca Bruno <lucabru@src.gnome.org>2015-03-18 14:07:29 +0000
commit7ef59c4fe2a87682054572a504fc7c6046c282e5 (patch)
tree0f0af3abb1d6558dfc8a289cc185e85cc31c262d /lib
parent506cbf05a9460ae452c29ebd1324eeae04082a2e (diff)
downloadnixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar.gz
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar.bz2
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar.lz
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar.xz
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.tar.zst
nixpkgs-7ef59c4fe2a87682054572a504fc7c6046c282e5.zip
nixos: Multiple service instances, apply to nginx. See #6784
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix15
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;
+    };
+
 }