liminix/pkgs/tufted/default.nix

32 lines
797 B
Nix
Raw Normal View History

2022-10-05 00:08:43 +02:00
{
lua5_3
, stdenv
, fetchFromGitHub
, makeWrapper
} :
let
lua = lua5_3.withPackages (ps: with ps; [
luasocket luaposix fennel
2022-10-05 00:08:43 +02:00
]);
in stdenv.mkDerivation {
pname = "tufted";
version = "1";
phases = [ "unpackPhase" "installPhase" ];
buildInputs = [
lua
];
2022-10-05 00:08:43 +02:00
nativeBuildInputs = [ makeWrapper ];
src = ./.;
installPhase = ''
mkdir -p $out/lib
cp tftp.lua tufted.fnl $out/lib
makeWrapper ${lua.pkgs.fennel}/bin/fennel \
2022-10-05 00:08:43 +02:00
$out/bin/tufted \
--prefix LUA_CPATH \; "${lua}/lib/lua/5.3/?.so" \
2022-10-05 00:08:43 +02:00
--add-flags "--add-fennel-path $out/lib/?.fnl" \
--add-flags "--add-package-path $out/lib/?.lua" \
--add-flags "--add-package-path ${lua}/share/lua/5.3/?.lua\;${lua}/share/lua/5.3/?/init.lua" \
2022-10-05 00:08:43 +02:00
--add-flags "$out/lib/tufted.fnl"
'';
}