Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua: consolidate setup hooks #67239

Merged
merged 3 commits into from
Sep 1, 2019
Merged

Conversation

Shados
Copy link
Member

@Shados Shados commented Aug 22, 2019

Motivation for this change
  • Means there are no longer two separate setup hooks for Lua packages, with partially-overlapping functionality.
  • Fixes pre-existing issues that came to light here.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @teto @vcunat can one of you two poke ofborg for this? I know from last time it would take me a couple days to do a nix-review for all the builds >.>.

Both prosody tests pass, I've manually tested luakit, and I've tested a handful of buildLuaPackage and buildLuarocksPackage derivations, all have worked fine.

@ofborg ofborg bot added the 6.topic: lua label Aug 22, 2019
@teto
Copy link
Member

teto commented Aug 22, 2019

thanks for taking care of this, I remember adjusting LUA_PATH to work with modules that had stuff in strange places but maybe with luarocks that was fixed. Anyway this will definitely needs a few nix-review runs to make sure it works fine/fix whatever needs to be fixed. I am

@Shados
Copy link
Member Author

Shados commented Aug 22, 2019

Odd. I just force-pushed the branch to fix an issue with my change to getPath, but it hasn't updated the PR...

@teto
Copy link
Member

teto commented Aug 22, 2019

wrong remote maybe :p ?

@Shados
Copy link
Member Author

Shados commented Aug 22, 2019

No, I followed the branch link at the top of this PR, and the commit hashes are clearly different. What the hell? I guess I'll try rebasing to master and force-push again to see if that gets github to pick it up =/.

- Lua packages now consistently use LUA_PATH/LUA_CPATH rather than a mix
  of those and NIX_LUA_PATH/NIX_LUA_CPATH
- Lua libraries are now consistently only added to the search path
variables if:
    1) The library actually has a corresponding directory to search
    2) The library is not already present in the search path
  This should help prevent the search paths from growing overly large
- Fixed bugs in some path helpers
- Changed the affected shell script indentation to 2 spaces; nixpkgs
  shell scripts are inconsistently split between 2 and 4 space
  indentation, but 2 matches better with the Nix expressions, so IMO it
  makes more sense
@Shados
Copy link
Member Author

Shados commented Aug 22, 2019

Nope, that didn't work either.

@Shados Shados force-pushed the lua-consolidate-setup-hooks branch 2 times, most recently from 19f476e to d6a555b Compare August 22, 2019 10:27
@Shados
Copy link
Member Author

Shados commented Aug 22, 2019

OK, looks like it was super delayed for some reason.

@lblasc
Copy link
Contributor

lblasc commented Aug 26, 2019

Did a quick test:

~/nixpkgs$ nix-shell -I nixpkgs=./. -p luajit.pkgs.cjson

[nix-shell:~/nixpkgs]$ echo $LUA_PATH
/nix/store/7kmls9ynfllvdny4qdf7vbljsa3jg3cx-luajit-2.1.0-beta3-lua-cjson-2.1.0.6-1/lib/lua/5.1/?.lua;/nix/store/7kmls9ynfllvdny4qdf7vbljsa3jg3cx-luajit-2.1.0-beta3-lua-cjson-2.1.0.6-1/share/lua/5.1/?.lua;/nix/store/7kmls9ynfllvdny4qdf7vbljsa3jg3cx-luajit-2.1.0-beta3-lua-cjson-2.1.0.6-1/share/lua/5.1/?/init.lua;/nix/store/7kmls9ynfllvdny4qdf7vbljsa3jg3cx-luajit-2.1.0-beta3-lua-cjson-2.1.0.6-1/lib/lua/5.1/?/init.lua;/nix/store/kqfhcx0z02ylx38af3maj8ddfsff42l0-luajit-2.1.0-beta3/lib/lua/5.1/?.lua;/nix/store/kqfhcx0z02ylx38af3maj8ddfsff42l0-luajit-2.1.0-beta3/share/lua/5.1/?.lua;/nix/store/kqfhcx0z02ylx38af3maj8ddfsff42l0-luajit-2.1.0-beta3/share/lua/5.1/?/init.lua;/nix/store/kqfhcx0z02ylx38af3maj8ddfsff42l0-luajit-2.1.0-beta3/lib/lua/5.1/?/init.lua;/nix/store/kqfhcx0z02ylx38af3maj8ddfsff42l0-luajit-2.1.0-beta3/share/luajit-2.1.0-beta3/?.lua

It works like before. Great work @Shados

@lblasc
Copy link
Contributor

lblasc commented Aug 31, 2019

Without this patches Lua packages in nix-shell are broken (without manual export of LUA_PATH and LUA_CPATH). @teto / @vcunat can you merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants