nixos/nginx: Support additional listen parameters (#56835)

This commit is contained in:
Janne Heß 2019-03-06 10:42:46 +01:00 committed by Danylo Hlynskyi
parent 6fb8b38afc
commit 3de5726e9b
2 changed files with 3 additions and 1 deletions

View File

@ -194,11 +194,12 @@ let
then filter (x: x.ssl) defaultListen
else defaultListen;
listenString = { addr, port, ssl, ... }:
listenString = { addr, port, ssl, extraParameters ? [], ... }:
"listen ${addr}:${toString port} "
+ optionalString ssl "ssl "
+ optionalString (ssl && vhost.http2) "http2 "
+ optionalString vhost.default "default_server "
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
+ ";";
redirectListen = filter (x: !x.ssl) defaultListen;

View File

@ -31,6 +31,7 @@ with lib;
addr = mkOption { type = str; description = "IP address."; };
port = mkOption { type = int; description = "Port number."; default = 80; };
ssl = mkOption { type = bool; description = "Enable SSL."; default = false; };
extraParameters = mkOption { type = listOf str; description = "Extra parameters of this listen directive."; default = []; example = [ "reuseport" "deferred" ]; };
}; });
default = [];
example = [