summary refs log tree commit diff
path: root/pkgs/servers/http/openresty
diff options
context:
space:
mode:
authorEmily <vcs@emily.moe>2020-02-04 22:06:02 +0000
committerAustin Seipp <aseipp@pobox.com>2020-02-04 19:30:40 -0600
commit6d046e1079601c38540d5eb67ce913632898605b (patch)
treee3a0a28976e8089499850323f7fc8cbe6bd79400 /pkgs/servers/http/openresty
parentdb3182a65d0c95afa197cb61c5be80e1c9a8278f (diff)
downloadnixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar.gz
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar.bz2
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar.lz
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar.xz
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.tar.zst
nixpkgs-6d046e1079601c38540d5eb67ce913632898605b.zip
openresty: rebase on top of nginx package
The primary motivation of this change was to allow third-party modules
to be used with OpenResty, but it also results in a significant
reduction of code duplication.
Diffstat (limited to 'pkgs/servers/http/openresty')
-rw-r--r--pkgs/servers/http/openresty/default.nix61
1 files changed, 22 insertions, 39 deletions
diff --git a/pkgs/servers/http/openresty/default.nix b/pkgs/servers/http/openresty/default.nix
index 328db9ec986..55e813a2ce7 100644
--- a/pkgs/servers/http/openresty/default.nix
+++ b/pkgs/servers/http/openresty/default.nix
@@ -1,52 +1,35 @@
-{ stdenv, fetchurl, openssl, zlib, pcre, postgresql, libxml2, libxslt,
-gd, geoip, perl }:
-
-with stdenv.lib;
-
-stdenv.mkDerivation rec {
+{ callPackage
+, runCommand
+, lib
+, fetchurl
+, postgresql
+, ...
+}@args:
+
+callPackage ../nginx/generic.nix args rec {
   pname = "openresty";
-  version = "1.15.8.2";
+  nginxVersion = "1.15.8";
+  version = "${nginxVersion}.2";
 
   src = fetchurl {
     url = "https://openresty.org/download/openresty-${version}.tar.gz";
     sha256 = "05jxrb8hv758nm38jil8n63q1nhrz3d249bsrwc7maa7sn24wss3";
   };
 
-  buildInputs = [ openssl zlib pcre libxml2 libxslt gd geoip postgresql ];
-  nativeBuildInputs = [ perl ];
+  fixPatch = patch:
+    runCommand "openresty-${patch.name}" { src = patch; } ''
+      substitute $src $out \
+        --replace "src/" "bundle/nginx-${nginxVersion}/src/"
+    '';
 
-  NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
+  buildInputs = [ postgresql ];
+
+  configureFlags = [ "--with-http_postgres_module" ];
 
   preConfigure = ''
     patchShebangs .
   '';
 
-  configureFlags = [
-    "--with-pcre-jit"
-    "--with-http_ssl_module"
-    "--with-http_v2_module"
-    "--with-http_realip_module"
-    "--with-http_addition_module"
-    "--with-http_xslt_module"
-    "--with-http_image_filter_module"
-    "--with-http_geoip_module"
-    "--with-http_sub_module"
-    "--with-http_dav_module"
-    "--with-http_flv_module"
-    "--with-http_mp4_module"
-    "--with-http_gunzip_module"
-    "--with-http_gzip_static_module"
-    "--with-http_auth_request_module"
-    "--with-http_random_index_module"
-    "--with-http_secure_link_module"
-    "--with-http_degradation_module"
-    "--with-http_stub_status_module"
-    "--with-http_postgres_module"
-    "--with-ipv6"
-  ];
-
-  enableParallelBuilding = true;
-
   postInstall = ''
     ln -s $out/luajit/bin/luajit-2.1.0-beta3 $out/bin/luajit-openresty
     ln -s $out/nginx/sbin/nginx $out/bin/nginx
@@ -55,8 +38,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A fast web application server built on Nginx";
     homepage    = http://openresty.org;
-    license     = licenses.bsd2;
-    platforms   = platforms.all;
-    maintainers = with maintainers; [ thoughtpolice lblasc ];
+    license     = lib.licenses.bsd2;
+    platforms   = lib.platforms.all;
+    maintainers = with lib.maintainers; [ thoughtpolice lblasc emily ];
   };
 }