certifix/package.nix

35 lines
827 B
Nix
Raw Normal View History

2024-09-25 09:20:14 +00:00
{
lua5_3
, stdenv
, makeWrapper
}:
let
pname = "certifix";
lua = lua5_3.withPackages (ps: [
# ps.dkjson
# ps.lpeg
ps.http
ps.luaposix
]);
inherit makeWrapper;
inherit (lua.pkgs) fennel;
in stdenv.mkDerivation {
inherit pname;
version = "0.1";
src = ./.;
makeFlags = [ "TARGET=${placeholder "out"}" ];
postInstall = ''
lua_path="`lua -e 'print(package.path)'`"
lua_cpath="`lua -e 'print(package.cpath)'`"
makeWrapper ${fennel}/bin/fennel \
$out/bin/${pname} \
--add-flags "--add-fennel-path $out/lib/?.fnl" \
--add-flags "--add-package-path '$out/lib/?.lua$lua_path'" \
--add-flags "--add-package-cpath '$out/lib/?.lua$lua_cpath'" \
--add-flags "$out/lib/main.fnl"
'';
buildInputs = [lua fennel];
nativeBuildInputs = [ makeWrapper ];
}