summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-10-20 18:53:11 +0200
committertv <tv@shackspace.de>2015-10-20 18:53:11 +0200
commitb2fd7be3ff755e17e9d303f03b9a2345623fd384 (patch)
tree04f73da4191cbea5aa39cebc6d3b9858bbc7e81b
parentc08a46fd54f4e4c21029b1b9cf3c12d2fbfc40d4 (diff)
nginx service: allow multiple listen entries
-rw-r--r--krebs/3modules/nginx.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/krebs/3modules/nginx.nix b/krebs/3modules/nginx.nix
index c5f38c27..0530921a 100644
--- a/krebs/3modules/nginx.nix
+++ b/krebs/3modules/nginx.nix
@@ -25,8 +25,12 @@ let
];
};
listen = mkOption {
- type = with types; str;
+ type = with types; either str (listOf str);
default = "80";
+ apply = x:
+ if typeOf x != "list"
+ then [x]
+ else x;
};
locations = mkOption {
type = with types; listOf (attrsOf str);
@@ -70,7 +74,7 @@ let
to-server = { server-names, listen, locations, extraConfig, ... }: ''
server {
- listen ${listen};
+ ${concatMapStringsSep "\n" (x: "listen ${x};") listen}
server_name ${toString server-names};
${extraConfig}
${indent (concatStrings (map to-location locations))}