2020-04-24 23:36:52 +00:00
|
|
|
{ callPackage
|
|
|
|
, runCommand
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
2022-12-28 21:21:41 +00:00
|
|
|
, perl
|
2020-04-24 23:36:52 +00:00
|
|
|
, postgresql
|
2021-10-28 06:52:43 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
, ...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
callPackage ../nginx/generic.nix args rec {
|
|
|
|
pname = "openresty";
|
2022-12-28 21:21:41 +00:00
|
|
|
nginxVersion = "1.21.4";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "${nginxVersion}.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://openresty.org/download/openresty-${version}.tar.gz";
|
2024-01-02 11:29:13 +00:00
|
|
|
sha256 = "sha256-M6hMY8/Z5GsOXGLrLdx7gGi9ouFoYxQ0O4n8P/0kzdM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-28 21:21:41 +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.
|
2020-12-03 08:41:04 +00:00
|
|
|
fixPatch = patch:
|
|
|
|
let name = patch.name or (builtins.baseNameOf patch); in
|
2020-05-15 21:57:56 +00:00
|
|
|
runCommand "openresty-${name}" { src = patch; } ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substitute $src $out \
|
2020-05-15 21:57:56 +00:00
|
|
|
--replace "a/" "a/bundle/nginx-${nginxVersion}/" \
|
|
|
|
--replace "b/" "b/bundle/nginx-${nginxVersion}/"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
nativeBuildInputs = [ perl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
buildInputs = [ postgresql ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs configure bundle/
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
configureFlags = [ "--with-http_postgres_module" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
ln -s $out/luajit/bin/luajit-2.1.0-beta3 $out/bin/luajit-openresty
|
2024-01-02 11:29:13 +00:00
|
|
|
ln -s $out/nginx/bin/nginx $out/bin/nginx
|
2020-06-15 15:56:04 +00:00
|
|
|
ln -s $out/nginx/conf $out/conf
|
|
|
|
ln -s $out/nginx/html $out/html
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) openresty-lua;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "A fast web application server built on Nginx";
|
2021-07-17 21:14:59 +00:00
|
|
|
homepage = "https://openresty.org";
|
2020-12-03 08:41:04 +00:00
|
|
|
license = lib.licenses.bsd2;
|
|
|
|
platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with lib.maintainers; [ thoughtpolice lblasc emily ];
|
|
|
|
};
|
|
|
|
}
|