From f20d8091d4b05298bb2376ca930110b1c1ae07a7 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Fri, 25 Dec 2020 22:49:01 +0100 Subject: [PATCH 1/2] apacheHttpd: passthru lua variables --- pkgs/servers/http/apache-httpd/2.4.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/http/apache-httpd/2.4.nix b/pkgs/servers/http/apache-httpd/2.4.nix index 4b63b589ea9..71f8c8054c7 100644 --- a/pkgs/servers/http/apache-httpd/2.4.nix +++ b/pkgs/servers/http/apache-httpd/2.4.nix @@ -84,7 +84,7 @@ stdenv.mkDerivation rec { ''; passthru = { - inherit apr aprutil sslSupport proxySupport ldapSupport; + inherit apr aprutil sslSupport proxySupport ldapSupport luaSupport lua5; }; meta = with stdenv.lib; { From f2ca4c8f1d237bc88b769f80332efcc4d0b531e5 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Fri, 25 Dec 2020 22:54:05 +0100 Subject: [PATCH 2/2] nixos/httpd: set lua paths We conditionally set the lua paths for the Apache mod_lua module. This allows executing Lua script handlers to require modules, that have been packaged with the supplied Lua derivation of Apache. For more information, see: https://httpd.apache.org/docs/2.4/mod/mod_lua.html#luapackagecpath https://httpd.apache.org/docs/2.4/mod/mod_lua.html#luapackagepath --- .../services/web-servers/apache-httpd/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index dc78728d663..de3c7d693d4 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -126,6 +126,13 @@ let ''; + luaSetPaths = '' + + LuaPackageCPath ${cfg.package.lua5}/lib/lua/${cfg.package.lua5.lua.luaversion}/?.so + LuaPackagePath ${cfg.package.lua5}/share/lua/${cfg.package.lua5.lua.luaversion}/?.lua + + ''; + mkVHostConf = hostOpts: let adminAddr = if hostOpts.adminAddr != null then hostOpts.adminAddr else cfg.adminAddr; @@ -326,6 +333,8 @@ let ${sslConf} + ${if cfg.package.luaSupport then luaSetPaths else ""} + # Fascist default - deny access to everything. Options FollowSymLinks