about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/http/openresty/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/http/openresty/default.nix')
-rw-r--r--nixpkgs/pkgs/servers/http/openresty/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/http/openresty/default.nix b/nixpkgs/pkgs/servers/http/openresty/default.nix
new file mode 100644
index 000000000000..734dfb041403
--- /dev/null
+++ b/nixpkgs/pkgs/servers/http/openresty/default.nix
@@ -0,0 +1,48 @@
+{ callPackage
+, runCommand
+, lib
+, fetchurl
+, postgresql
+, ...
+}@args:
+
+callPackage ../nginx/generic.nix args rec {
+  pname = "openresty";
+  nginxVersion = "1.17.8";
+  version = "${nginxVersion}.2";
+
+  src = fetchurl {
+    url = "https://openresty.org/download/openresty-${version}.tar.gz";
+    sha256 = "1813w33hjm1hcqvl3b3f67qgi5zfjiqg6s01hiy12a5j3jqilcig";
+  };
+
+  fixPatch = patch: let name = patch.name or (builtins.baseNameOf patch); in
+    runCommand "openresty-${name}" { src = patch; } ''
+      substitute $src $out \
+        --replace "a/" "a/bundle/nginx-${nginxVersion}/" \
+        --replace "b/" "b/bundle/nginx-${nginxVersion}/"
+    '';
+
+  buildInputs = [ postgresql ];
+
+  configureFlags = [ "--with-http_postgres_module" ];
+
+  preConfigure = ''
+    patchShebangs .
+  '';
+
+  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 = {
+    description = "A fast web application server built on Nginx";
+    homepage    = "http://openresty.org";
+    license     = lib.licenses.bsd2;
+    platforms   = lib.platforms.all;
+    maintainers = with lib.maintainers; [ thoughtpolice lblasc emily ];
+  };
+}