From 2d18a83323be0e26451ac8b99f03bcbb68c2012e Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Nov 2026 14:04:40 +0000 Subject: cgit-about-filter: check syntax at build time cgit loads Lua filters at request time, and with caching enabled, a filter that fails to load produces an empty response and an error page in a cache lock file, with nothing in any log. Fail the build instead. --- pkgs/simple/cgit-about-filter/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'pkgs') diff --git a/pkgs/simple/cgit-about-filter/default.nix b/pkgs/simple/cgit-about-filter/default.nix index a05020f..14b9aa9 100644 --- a/pkgs/simple/cgit-about-filter/default.nix +++ b/pkgs/simple/cgit-about-filter/default.nix @@ -1,6 +1,14 @@ -{ gitMinimal, lib, md4c, replaceVars }: +{ gitMinimal, lib, luajit, md4c, replaceVarsWith }: -replaceVars ./cgit-about-filter.lua { - git = lib.getExe gitMinimal; - md2html = lib.getExe md4c; +replaceVarsWith { + src = ./cgit-about-filter.lua; + replacements = { + git = lib.getExe gitMinimal; + md2html = lib.getExe md4c; + }; + # cgit runs Lua filters with LuaJIT. It reports errors in them only as + # an error page, which ends up in the cache rather than the response. + postCheck = '' + ${lib.getExe luajit} -b "$target" /dev/null + ''; } -- cgit v1.3.1