2023-02-25 00:03:09 +01:00
|
|
|
{
|
|
|
|
lua5_3
|
|
|
|
, netlink-lua
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
lua = lua5_3;
|
|
|
|
netlink = netlink-lua.override {inherit lua;};
|
|
|
|
fennel = lua.pkgs.fennel;
|
|
|
|
in stdenv.mkDerivation rec {
|
2023-03-01 18:55:52 +01:00
|
|
|
pname = "ifwait";
|
2023-02-25 00:03:09 +01:00
|
|
|
version = "1";
|
2023-03-01 18:55:52 +01:00
|
|
|
phases = [ "installPhase" ];
|
2023-02-25 00:03:09 +01:00
|
|
|
|
2023-03-01 18:55:52 +01:00
|
|
|
buildInputs = [ lua netlink ];
|
|
|
|
nativeBuildInputs = [ makeWrapper fennel ];
|
2023-02-25 00:03:09 +01:00
|
|
|
|
2023-03-01 18:55:52 +01:00
|
|
|
LUA_CPATH = "${netlink}/lib/lua/${lua.luaversion}/\?.so"; # for nix-shell
|
2023-02-25 00:03:09 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/lib
|
2023-03-01 18:55:52 +01:00
|
|
|
fennel --compile ${./ifwait.fnl} > $out/lib/${pname}.lua
|
2023-02-25 00:03:09 +01:00
|
|
|
|
|
|
|
makeWrapper ${lua}/bin/lua $out/bin/${pname} \
|
|
|
|
--prefix LUA_CPATH ";" ${netlink}/lib/lua/${lua.luaversion}/\?.so \
|
2023-03-01 18:55:52 +01:00
|
|
|
--add-flags $out/lib/${pname}.lua
|
2023-02-25 00:03:09 +01:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
|
|
|
# to use fennel.view,
|
|
|
|
# --prefix LUA_PATH ";" ${fennel}/share/lua/5.2/\?.lua \
|