add LuaProfiler to dev shell

This commit is contained in:
Daniel Barlow 2025-06-11 22:06:54 +01:00
parent 8637731c60
commit deedd02efd

View File

@ -16,13 +16,34 @@ let
};
};
fennel-ls = pkgs.fennel-ls.override { inherit (package) lua luaPackages; };
luaProfiler =
let
inherit (pkgs) stdenv cmake;
inherit (package) lua;
in stdenv.mkDerivation {
name = "LuaProfiler";
src = fetchFromGitHub {
owner = "Patrick08T";
repo = "LuaProfiler";
rev = "abb989337f6f46b820c9d2eb1e1d339e8f6f3760";
hash = "sha256-43kwZCZZmWD5ens1qCzD7LTg/jKMfcb9Vw/DBiN2sSo=";
};
buildInputs = [ lua ];
installPhase = ''
mkdir -p "$out/lib/lua/${lua.luaversion}"
echo cp /build/source/bin/release/libluaperf.so "$out/lib/lua/${lua.luaversion}"
cp /build/source/bin/release/libluaperf.so "$out/lib/lua/${lua.luaversion}"
'';
nativeBuildInputs = [ cmake ];
};
in
package.overrideAttrs(o: {
nativeBuildInputs = [ fennel-ls ] ++ o.nativeBuildInputs;
nativeBuildInputs = [ fennel-ls luaProfiler flamegraph ] ++ o.nativeBuildInputs;
shellHook = ''
mkdir -p bin
( cd bin && ln -sf `type -p fennel-ls` `type -p fennel` . )
export LUA_CPATH=$(lua -e "print(package.cpath)")
export LUA_CPATH=$(lua -e "print(package.cpath)")\;${luaProfiler}/lib/lua/${package.lua.luaversion}/\?.so
export LUA_PATH=$(lua -e "print(package.path)")\;$RXI_JSON/share/lua/5.3/?.lua
'';
})