From 85760026a07d321f8f5dfd1b5363128e8c567dc5 Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Tue, 2 Jun 2020 17:00:09 +1200 Subject: [PATCH 1/4] openresty: make compatible with nixos nginx module --- pkgs/servers/http/openresty/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/http/openresty/default.nix b/pkgs/servers/http/openresty/default.nix index 9c01cfb19e1..d845d92ec8a 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 = { From 44007dec5c96dbfa3aa2aa5850a4c05804eae38e Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Tue, 2 Jun 2020 17:01:03 +1200 Subject: [PATCH 2/4] nixos/nginx: ensure all variants have a basic level of testing --- nixos/tests/all-tests.nix | 1 + nixos/tests/nginx-variants.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nixos/tests/nginx-variants.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 796c626f3dd..30aa15c3d53 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -233,6 +233,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 00000000000..ca4655391bc --- /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" ] +) From dca001e92312a4bc837f2a087c24fbea4069d8ca Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Sat, 20 Jun 2020 14:22:34 +1200 Subject: [PATCH 3/4] nginx: change how the perl module is configured Previously, http_perl_module was disabled by overriding perl=null -- this means it is impossible to disable http_perl_module in openresty, since openresty requires perl for its configure scripts. --- pkgs/servers/http/nginx/generic.nix | 3 ++- pkgs/top-level/all-packages.nix | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index 80bc1458ad7..6ec5b0a7851 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 072c892ccd6..7159c101d38 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15847,14 +15847,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 ]; From 22906fc7a555ea67a5742b6d21a2af76da1fa518 Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Sat, 20 Jun 2020 14:27:50 +1200 Subject: [PATCH 4/4] openresty: disable the http_perl_module I have been experiencing intermittent segfaults inside the perl module on startup during config parsing, despite not actually using any perl features in my config. This creates consistency with the standard nginx packages, and the upstream openresty binaries. --- pkgs/top-level/all-packages.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7159c101d38..6620f56aef3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15884,7 +15884,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 { };