luaPackages.enet: init at 1.2-1

This commit is contained in:
Ulysses Zhan
2026-03-19 19:04:42 -07:00
parent 398d36dd3c
commit 09b296375d
3 changed files with 48 additions and 0 deletions
@@ -675,6 +675,39 @@ final: prev: {
}
) { };
enet = callPackage (
{
buildLuarocksPackage,
fetchFromGitHub,
fetchurl,
luaOlder,
}:
buildLuarocksPackage {
pname = "enet";
version = "1.2-1";
knownRockspec =
(fetchurl {
url = "mirror://luarocks/enet-1.2-1.rockspec";
sha256 = "0jf0qxf3lsrmc1dww7b7i6srqp2cy8caqv9f1rbva7f6rnppxzra";
}).outPath;
src = fetchFromGitHub {
owner = "leafo";
repo = "lua-enet";
tag = "v1.2";
hash = "sha256-GomfJAPbR+y469LuaNPrkab0Wd3xAsAhT4uqbDo8BUA=";
};
disabled = luaOlder "5.1";
meta = {
homepage = "http://leafo.net/lua-enet";
description = "A library for doing network communication in Lua";
maintainers = with lib.maintainers; [ ulysseszhan ];
license.fullName = "MIT";
};
}
) { };
fennel = callPackage (
{
buildLuarocksPackage,
@@ -10,6 +10,7 @@
coreutils,
curl,
dbus,
enet,
expat,
fd,
fetchFromGitHub,
@@ -147,6 +148,19 @@ in
'';
});
enet = prev.enet.overrideAttrs (old: {
postPatch = ''
# luaL_checkint is removed in Lua 5.3, and luaL_register is removed in Lua 5.4
sed -i '/#include "lauxlib.h"/a\
#if LUA_VERSION_NUM >= 502\
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))\
#define luaL_register(L,n,f) ((n) ? luaL_newlib(L,f) : luaL_setfuncs(L,f,0))\
#endif
' enet.c
'';
buildInputs = old.buildInputs ++ [ enet ];
});
fzf-lua = prev.fzf-lua.overrideAttrs {
# FIXME: https://github.com/NixOS/nixpkgs/issues/431458
# fzf-lua throws `address already in use` on darwin