diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index dc78728d6636..de3c7d693d47 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
diff --git a/pkgs/servers/http/apache-httpd/2.4.nix b/pkgs/servers/http/apache-httpd/2.4.nix
index 4b63b589ea95..71f8c8054c71 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; {