diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index de3c7d693d4..7f50b8fd8d4 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -126,10 +126,14 @@ let
'';
- luaSetPaths = ''
+ luaSetPaths = let
+ # support both lua and lua.withPackages derivations
+ luaversion = cfg.package.lua5.lua.luaversion or cfg.package.lua5.luaversion;
+ in
+ ''
- LuaPackageCPath ${cfg.package.lua5}/lib/lua/${cfg.package.lua5.lua.luaversion}/?.so
- LuaPackagePath ${cfg.package.lua5}/share/lua/${cfg.package.lua5.lua.luaversion}/?.lua
+ LuaPackageCPath ${cfg.package.lua5}/lib/lua/${luaversion}/?.so
+ LuaPackagePath ${cfg.package.lua5}/share/lua/${luaversion}/?.lua
'';
@@ -333,7 +337,7 @@ let
${sslConf}
- ${if cfg.package.luaSupport then luaSetPaths else ""}
+ ${optionalString cfg.package.luaSupport luaSetPaths}
# Fascist default - deny access to everything.