diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 98947d70eaa4..7056d414e9e9 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -236,6 +236,7 @@ in nginx-pubhtml = handleTest ./nginx-pubhtml.nix {}; nginx-sandbox = handleTestOn ["x86_64-linux"] ./nginx-sandbox.nix {}; nginx-sso = handleTest ./nginx-sso.nix {}; + nginx-variants = handleTest ./nginx-variants.nix {}; nix-ssh-serve = handleTest ./nix-ssh-serve.nix {}; nixos-generate-config = handleTest ./nixos-generate-config.nix {}; novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {}; diff --git a/nixos/tests/nginx-variants.nix b/nixos/tests/nginx-variants.nix new file mode 100644 index 000000000000..ca4655391bc5 --- /dev/null +++ b/nixos/tests/nginx-variants.nix @@ -0,0 +1,33 @@ +{ system ? builtins.currentSystem, + config ? {}, + pkgs ? import ../.. { inherit system config; } +}: + +with import ../lib/testing-python.nix { inherit system pkgs; }; + +builtins.listToAttrs ( + builtins.map + (nginxName: + { + name = nginxName; + value = makeTest { + name = "nginx-variant-${nginxName}"; + + machine = { pkgs, ... }: { + services.nginx = { + enable = true; + virtualHosts.localhost.locations."/".return = "200 'foo'"; + package = pkgs."${nginxName}"; + }; + }; + + testScript = '' + machine.wait_for_unit("nginx") + machine.wait_for_open_port(80) + machine.succeed('test "$(curl -fvvv http://localhost/)" = foo') + ''; + }; + } + ) + [ "nginxStable" "nginxUnstable" "nginxShibboleth" "openresty" "tengine" ] +) diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index 80bc1458ad7a..6ec5b0a78510 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -4,6 +4,7 @@ , withDebug ? false , withStream ? true , withMail ? false +, withPerl ? true , modules ? [] , ... }: @@ -87,7 +88,7 @@ stdenv.mkDerivation { ] ++ optionals withMail [ "--with-mail" "--with-mail_ssl_module" - ] ++ optional (perl != null) [ + ] ++ optionals withPerl [ "--with-http_perl_module" "--with-perl=${perl}/bin/perl" "--with-perl_modules_path=lib/perl5" diff --git a/pkgs/servers/http/openresty/default.nix b/pkgs/servers/http/openresty/default.nix index 9c01cfb19e1d..d845d92ec8a5 100644 --- a/pkgs/servers/http/openresty/default.nix +++ b/pkgs/servers/http/openresty/default.nix @@ -34,6 +34,8 @@ callPackage ../nginx/generic.nix args rec { postInstall = '' ln -s $out/luajit/bin/luajit-2.1.0-beta3 $out/bin/luajit-openresty ln -s $out/nginx/sbin/nginx $out/bin/nginx + ln -s $out/nginx/conf $out/conf + ln -s $out/nginx/html $out/html ''; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 14a494a164f5..e31c42261e72 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15927,14 +15927,14 @@ in nginx = nginxStable; nginxStable = callPackage ../servers/http/nginx/stable.nix { - perl = null; + withPerl = false; # We don't use `with` statement here on purpose! # See https://github.com/NixOS/nixpkgs/pull/10474/files#r42369334 modules = [ nginxModules.rtmp nginxModules.dav nginxModules.moreheaders ]; }; nginxMainline = callPackage ../servers/http/nginx/mainline.nix { - perl = null; + withPerl = false; # We don't use `with` statement here on purpose! # See https://github.com/NixOS/nixpkgs/pull/10474/files#r42369334 modules = [ nginxModules.dav nginxModules.moreheaders ]; @@ -15964,7 +15964,9 @@ in openafs = callPackage ../servers/openafs/1.6 { tsmbac = null; ncurses = null; }; openafs_1_8 = callPackage ../servers/openafs/1.8 { tsmbac = null; ncurses = null; }; - openresty = callPackage ../servers/http/openresty { }; + openresty = callPackage ../servers/http/openresty { + withPerl = false; + }; opensmtpd = callPackage ../servers/mail/opensmtpd { }; opensmtpd-extras = callPackage ../servers/mail/opensmtpd/extras.nix { };