NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.19k stars 14.19k forks source link

harmonize lua wrapping across nixpkgs #169229

Open teto opened 2 years ago

teto commented 2 years ago

Issue description

One problem is that handling of LUA_PATH across nixpkgs is very heterogeneous, and so it makes harder to make some global changes. I think it's heterogeneous partly because lua utilities are broken. For instance the LUA_PATH generation hook removes the defaults from the lua interpreter (";;"). Many modules hardcode the different lua paths instead of using e.g. wrapLuaProgram, luaPathList from pkgs/development/lua-modules/lib.nix . I believe wrapLuaProgram is broken so let's first fix this and add some tests. any help welcome.

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

nixos-discourse commented 2 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/using-lua-modules/19769/2

pinpox commented 2 years ago

I can help testing if @teto or someone else can give some guidance on how/where to start. Fixing wrapLuaProgram would be great.

teto commented 2 years ago

@pinpox that would be awesome ! https://discourse.nixos.org/t/using-lua-modules/19769 looks simple One should be able to create a shell containing

 lua = pkgs.lua5_3.withPackages(ps: with ps; [
      cjson
      http
    ]);

and require the package afterwards. As I explained in the discourse what I would do is to look at the wrapper and what its LUA_PATH value is. It should be wrong, then we need to cleanup the code as I had started in https://github.com/NixOS/nixpkgs/pull/177556 . You can DM me on matrix if you have questions.

rrrnld commented 2 years ago

I can also gladly help with further testing. I have described my setup in the linked issue.