2020-02-04 22:06:02 +00:00
|
|
|
{ callPackage
|
|
|
|
, runCommand
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, postgresql
|
|
|
|
, ...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
callPackage ../nginx/generic.nix args rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "openresty";
|
2020-12-02 08:08:02 +00:00
|
|
|
nginxVersion = "1.19.3";
|
2021-07-17 09:33:10 +01:00
|
|
|
version = "${nginxVersion}.2";
|
2014-08-20 06:34:29 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://openresty.org/download/openresty-${version}.tar.gz";
|
2021-07-17 09:33:10 +01:00
|
|
|
sha256 = "1fav3qykckqcyw9ksi8s61prpwab44zbcvj95rwfpfqgk5jffh6f";
|
2014-08-20 06:34:29 +01:00
|
|
|
};
|
|
|
|
|
2020-12-02 08:08:02 +00:00
|
|
|
# generic.nix applies fixPatch on top of every patch defined there. This
|
|
|
|
# allows updating the patch destination, as openresty has nginx source code
|
|
|
|
# in a different folder.
|
|
|
|
fixPatch = patch:
|
|
|
|
let name = patch.name or (builtins.baseNameOf patch); in
|
2020-04-25 15:02:23 +01:00
|
|
|
runCommand "openresty-${name}" { src = patch; } ''
|
2020-02-04 22:06:02 +00:00
|
|
|
substitute $src $out \
|
2020-04-25 15:02:23 +01:00
|
|
|
--replace "a/" "a/bundle/nginx-${nginxVersion}/" \
|
|
|
|
--replace "b/" "b/bundle/nginx-${nginxVersion}/"
|
2020-02-04 22:06:02 +00:00
|
|
|
'';
|
2018-03-04 19:52:32 +00:00
|
|
|
|
2020-02-04 22:06:02 +00:00
|
|
|
buildInputs = [ postgresql ];
|
|
|
|
|
|
|
|
configureFlags = [ "--with-http_postgres_module" ];
|
2018-03-04 19:52:32 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
2014-08-20 06:34:29 +01:00
|
|
|
|
2018-03-04 19:52:32 +00:00
|
|
|
postInstall = ''
|
|
|
|
ln -s $out/luajit/bin/luajit-2.1.0-beta3 $out/bin/luajit-openresty
|
|
|
|
ln -s $out/nginx/sbin/nginx $out/bin/nginx
|
2020-06-02 06:00:09 +01:00
|
|
|
ln -s $out/nginx/conf $out/conf
|
|
|
|
ln -s $out/nginx/html $out/html
|
2014-08-20 06:34:29 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A fast web application server built on Nginx";
|
2021-07-17 09:33:10 +01:00
|
|
|
homepage = "https://openresty.org";
|
2020-12-02 08:08:02 +00:00
|
|
|
license = lib.licenses.bsd2;
|
|
|
|
platforms = lib.platforms.all;
|
2020-02-04 22:06:02 +00:00
|
|
|
maintainers = with lib.maintainers; [ thoughtpolice lblasc emily ];
|
2014-08-20 06:34:29 +01:00
|
|
|
};
|
|
|
|
}
|