I’ve been stuck for the past week trying to install a certain Luarocks package, specifically “enet” bindings for lua. I haven’t been able to find any good resources about how to do this. I can use Luarocks locally but when I go to run a program which requires the library, it says libenet.so.7: cannot open shared object file: No such file or directory which I think means it can’t find the base enet library.
But I have enet in my “configuration.nix” so I have no clue why It doesnt find it there.
My own lua script which uses enet for networking stuff. I made it when I was on ubuntu, but now that I’m on nix I can’t seem to use Luarocks to get it like I did before.
Running it just by “lua script.lua” and I get the same result no matter which lua version I use.
So after even more trial and error, I came across luarocks-nix and used that to generate a .nix script for the package I needed. This does not work on its own though and I had to edit it to add the base enet package. Specifically the propagatedBuildInputs = [ pkgs.enet ]; line.
I then added (luajitPackages.callPackage ./lua-enet.nix {}) to my configuration.nix to load it, and now my script can recognize enet when I run it with luajit.
No clue if this is the correct way, but it works. Hope this saves others the time and frustration I had to go through.