summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-07-27 13:48:13 +0000
committerRobin Gloster <mail@glob.in>2016-07-28 11:59:13 +0000
commit3ccfca7d6b6a642bbe7075d09e4ffc0a89743038 (patch)
tree50c374c79b181f76eede562b830f1a80b1780525 /nixos
parent511410789be5ef0baa441b1a684b3dff63d33704 (diff)
downloadnixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar.gz
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar.bz2
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar.lz
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar.xz
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.tar.zst
nixpkgs-3ccfca7d6b6a642bbe7075d09e4ffc0a89743038.zip
nginx module: httpConfig backward compatibility
Revert httpConfig its old behaviour and make it mutually exclusive to
the new structured configuration. Adds appendHttpConfig to have the
ability to write custom config in the generated http block.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-servers/nginx/default.nix28
1 files changed, 25 insertions, 3 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index 62737a28935..ba3618cc101 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -18,6 +18,7 @@ let
 
     ${cfg.config}
 
+    ${optionalString (cfg.httpConfig == "") ''
     http {
       include ${cfg.package}/conf/mime.types;
       include ${cfg.package}/conf/fastcgi.conf;
@@ -89,8 +90,15 @@ let
         }
       ''}
 
+      ${cfg.appendHttpConfig}
+    }''}
+
+    ${optionalString (cfg.httpConfig != "") ''
+    http {
+      include ${cfg.package}/conf/mime.types;
+      include ${cfg.package}/conf/fastcgi.conf;
       ${cfg.httpConfig}
-    }
+    }''}
 
     ${cfg.appendConfig}
   '';
@@ -245,7 +253,22 @@ in
       httpConfig = mkOption {
         type = types.lines;
         default = "";
-        description = "Configuration lines to be appended inside of the http {} block.";
+        description = "
+          Configuration lines to be set inside the http block.
+          This is mutually exclusive with the structured configuration
+          via virtualHosts and the recommendedXyzSettings configuration
+          options. See appendHttpConfig for appending to the generated http block.
+        ";
+      };
+
+      appendHttpConfig = mkOption {
+        type = types.lines;
+        default = "";
+        description = "
+          Configuration lines to be appended to the generated http block.
+          This is mutually exclusive with using httpConfig for specifying the whole
+          http block verbatim.
+        ";
       };
 
       stateDir = mkOption {
@@ -353,7 +376,6 @@ in
       ) virtualHosts
     );
 
-
     users.extraUsers = optionalAttrs (cfg.user == "nginx") (singleton
       { name = "nginx";
         group = cfg.group;