at 23.11-beta 978 B view raw
1{ lua 2, hello 3, wrapLua 4, lib, fetchFromGitHub 5, fetchFromGitLab 6, pkgs 7}: 8let 9 10 runTest = lua: { name, command }: 11 pkgs.runCommandLocal "test-${lua.name}" ({ 12 nativeBuildInputs = [lua]; 13 meta.platforms = lua.meta.platforms; 14 }) ('' 15 source ${./assert.sh} 16 '' 17 + command 18 + "touch $out" 19 ); 20 21 wrappedHello = hello.overrideAttrs(oa: { 22 propagatedBuildInputs = [ 23 wrapLua 24 lua.pkgs.cjson 25 ]; 26 postFixup = '' 27 wrapLuaPrograms 28 ''; 29 }); 30in 31 pkgs.recurseIntoAttrs ({ 32 33 checkAliases = runTest lua { 34 name = "check-aliases"; 35 command = '' 36 generated=$(lua -e 'print(package.path)') 37 golden_LUA_PATH='./share/lua/${lua.luaversion}/?.lua;./?.lua;./?/init.lua' 38 39 assertStringEqual "$generated" "$golden_LUA_PATH" 40 ''; 41 }; 42 43 checkWrapping = pkgs.runCommandLocal "test-${lua.name}" ({ 44 }) ('' 45 grep -- 'LUA_PATH=' ${wrappedHello}/bin/hello 46 touch $out 47 ''); 48 49}) 50