nginx module: add resolver config

+30
+30
nixos/modules/services/web-servers/nginx/default.nix
··· 38 include ${cfg.package}/conf/fastcgi.conf; 39 include ${cfg.package}/conf/uwsgi_params; 40 41 ${optionalString (cfg.recommendedOptimisation) '' 42 # optimisation 43 sendfile on; ··· 383 default = null; 384 example = "/path/to/dhparams.pem"; 385 description = "Path to DH parameters file."; 386 }; 387 388 virtualHosts = mkOption {
··· 38 include ${cfg.package}/conf/fastcgi.conf; 39 include ${cfg.package}/conf/uwsgi_params; 40 41 + ${optionalString (cfg.resolver.addresses != []) '' 42 + resolver ${toString cfg.resolver.addresses} ${optionalString (cfg.resolver.valid != "") "valid=${cfg.resolver.valid}"}; 43 + ''} 44 + 45 ${optionalString (cfg.recommendedOptimisation) '' 46 # optimisation 47 sendfile on; ··· 387 default = null; 388 example = "/path/to/dhparams.pem"; 389 description = "Path to DH parameters file."; 390 + }; 391 + 392 + resolver = mkOption { 393 + type = types.submodule { 394 + options = { 395 + addresses = mkOption { 396 + type = types.listOf types.str; 397 + default = []; 398 + example = literalExample ''[ "[::1]" "127.0.0.1:5353" ]''; 399 + description = "List of resolvers to use"; 400 + }; 401 + valid = mkOption { 402 + type = types.str; 403 + default = ""; 404 + example = "30s"; 405 + description = '' 406 + By default, nginx caches answers using the TTL value of a response. 407 + An optional valid parameter allows overriding it 408 + ''; 409 + }; 410 + }; 411 + }; 412 + description = '' 413 + Configures name servers used to resolve names of upstream servers into addresses 414 + ''; 415 + default = {}; 416 }; 417 418 virtualHosts = mkOption {