luaPackages.luacov: fix HTML report generation

Fixed up the HTML report generation capability of the `luacov` Lua
package. It is not entirely clear to me whether this used to work, and
got broken at some point, or whether it never worked.

The issue is that `luacov` uses the `datafile` rock to resolve its
static files for HTML reports (such as `prettier.js`, `report.css`,
etc.), which does not properly work in a Nix environment. This is
because `datafile` relies on the specific structure of the usual
LuaRocks directory to scan for files, which `nixpkgs` messes with.

Since we can't rely on `datafile` to detect a LuaRocks environment, I've
added a manual copy step to the derivation, merging the static files
with the other Lua files. We can then utilize the source-relative opener
to find the appropriate files.
This commit is contained in:
Xoddiel d'Croy
2025-11-29 03:02:25 +01:00
parent 381d2403ca
commit 890281173c
@@ -491,6 +491,13 @@ in
};
});
luacov = prev.luacov.overrideAttrs (oa: {
postInstall = ''
mkdir -p $out/share/lua/${lua.luaversion}/luacov/reporter/src/luacov/reporter/html
mv src/luacov/reporter/html/static $out/share/lua/${lua.luaversion}/luacov/reporter/src/luacov/reporter/html/static
'';
});
luadbi-mysql = prev.luadbi-mysql.overrideAttrs (oa: {
luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {