summary refs log tree commit diff
path: root/nixos/modules/services/web-servers
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2017-04-15 15:09:18 +0200
committerRobin Gloster <mail@glob.in>2017-08-04 02:15:46 +0200
commit94a2cba8d9a89036965089e4d9eb963d422ff93c (patch)
tree1a075782387c79ac015d67e7f6256e07922d6703 /nixos/modules/services/web-servers
parent75bbcd421570f5dfbaaab5d2b986709a9cb8b7d5 (diff)
downloadnixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar.gz
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar.bz2
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar.lz
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar.xz
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.tar.zst
nixlib-94a2cba8d9a89036965089e4d9eb963d422ff93c.zip
nginx module: add resolver config
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r--nixos/modules/services/web-servers/nginx/default.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index c5ba8eb147cf..2f691b0e9df9 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -38,6 +38,10 @@ let
       include ${cfg.package}/conf/fastcgi.conf;
       include ${cfg.package}/conf/uwsgi_params;
 
+      ${optionalString (cfg.resolver.addresses != []) ''
+        resolver ${toString cfg.resolver.addresses} ${optionalString (cfg.resolver.valid != "") "valid=${cfg.resolver.valid}"};
+      ''}
+
       ${optionalString (cfg.recommendedOptimisation) ''
         # optimisation
         sendfile on;
@@ -385,6 +389,32 @@ in
         description = "Path to DH parameters file.";
       };
 
+      resolver = mkOption {
+        type = types.submodule {
+          options = {
+            addresses = mkOption {
+              type = types.listOf types.str;
+              default = [];
+              example = literalExample ''[ "[::1]" "127.0.0.1:5353" ]'';
+              description = "List of resolvers to use";
+            };
+            valid = mkOption {
+              type = types.str;
+              default = "";
+              example = "30s";
+              description = ''
+                By default, nginx caches answers using the TTL value of a response.
+                An optional valid parameter allows overriding it
+              '';
+            };
+          };
+        };
+        description = ''
+          Configures name servers used to resolve names of upstream servers into addresses
+        '';
+        default = {};
+      };
+
       virtualHosts = mkOption {
         type = types.attrsOf (types.submodule (import ./vhost-options.nix {
           inherit config lib;