Unverified Commit 09b29637 authored by Ulysses Zhan's avatar Ulysses Zhan
Browse files

luaPackages.enet: init at 1.2-1

parent 398d36dd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ cyan,,,,,,
datafile,,,,,,
digestif,,,,,5.3,
dkjson,,,,,,
enet,,,,,,ulysseszhan
fennel,,,,,,misterio77
fidget.nvim,,,,,5.1,mrcjkb
fifo,,,,,,
+33 −0
Original line number Diff line number Diff line
@@ -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,
+14 −0
Original line number Diff line number Diff line
@@ -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