From 890281173ce6390e780c4e86e8c71192ca2ec2aa Mon Sep 17 00:00:00 2001 From: Xoddiel d'Croy Date: Sat, 29 Nov 2025 03:02:25 +0100 Subject: [PATCH] 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. --- pkgs/development/lua-modules/overrides.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/lua-modules/overrides.nix b/pkgs/development/lua-modules/overrides.nix index e8f13169c3d0..7e9316ee3a22 100644 --- a/pkgs/development/lua-modules/overrides.nix +++ b/pkgs/development/lua-modules/overrides.nix @@ -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 {