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

Meta issue about lua ecosystem progress #56398

Open
20 of 30 tasks
teto opened this issue Feb 26, 2019 · 20 comments
Open
20 of 30 tasks

Meta issue about lua ecosystem progress #56398

teto opened this issue Feb 26, 2019 · 20 comments
Labels
5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: lua

Comments

@teto
Copy link
Member

teto commented Feb 26, 2019

Issue description

Meta issue about changes to how lua is handled in nixpkgs (obsoletes #33903).

Possibie improvements

  • rename lua5_1 into lua51 etc to do as python packages. It would also improve consistency within lua, we have lua5_1 and lua51Packages
  • improve cmake based luarocks packages cmake build system doesnt take variables from LUAROCKS_CONFIG luarocks/luarocks#1160 (waiting for structured attributes) not sure that's needed anymore since luarocks maintainers dont really encourage it
  • speed up maintainers/scripts/update-luarocks (cache rocks/rockspec)
  • support the different luarocks mirror
  • add luarocks to the generated ones (and rename the current one to luarocks-bootstrap ?)
  • implement a lua.mkDerivation
  • rewrite the interpreters to share more code (python-like)
  • unify the getLuaPathList / getLuaPath / setuphook (between buildLuaPackage / buildLuaRocks
  • add propagatedBuildInputs to the generated luarocks config external_deps_dirs = {} (https://github.com/luarocks/luarocks/wiki/Paths-and-external-dependencies)
  • ~~ export/use version specific variables such as LUA_PATH_5_2/LUAROCKS_CONFIG_5_2 ~~ (wont do but someone feel free to pickup)
  • let luarocks check for dependencies via exporting the different rocktrees in temporary config as is kind of done in torch-distro.nix
  • remove the luarocks warning about different folder owners
  • a better way to tell luarocks where to look for buildInputs https://github.com/luarocks/luarocks/wiki/Platform-agnostic-external-dependencies
    Here is an upstreaming roadmap:
  • convert packages to use lua.withPackages /wrapLuaPrograms
  • convert some packages to luarocks-based packaging (Lua: convert some more packages #55747)
  • move packages from torch-distro.nix to the generated ones torchPackages, torch-repl: remove #81173
  • update documentation doc: update lua documentation #55302
  • leverage the rockspec version 3 to run tests for lua packages
  • remove the use of with self; in generated-packages.nix . I have a (messy) working prototype at teto@dde3bd2
  • deal with strange packages like cqueue that have one rockspec per interpreter c01fe37#commitcomment-32572249
  • added luarocks autocompletion
  • While investigating how to reconcile vim plugins and lua packages, I found out the luarocks config entry
    lua_modules_path = "" that creates a flat hierarchy and could reduce the number of nested folders in our nix packages. Investigate its usage.

@Shados
Copy link
Member

Shados commented Jun 14, 2019

Some nice things that would require upstream luarocks changes (from a brief preliminary investigation):

  • Make luarocks doc work for luarocks derivations in the current profile
  • Make luarocks show work for luarocks derivations in the current profile
  • Make luarocks list work for luarocks derivations in the current profile
  • Make the luarocks.loader module and the luarocks which command work for luarocks derivations in the current profile?

None of these are super necessary, but all would be potentially useful.

These would require changes to luarocks to make it capable of searching multiple rocks trees for the relevant operations. It already does this for luarocks make/luarocks install if you use --deps-mode=all (and explicitly specify the locations of the rocks trees), but it does not do this for other operations AFAICT.

They would also need changes to add a way to have luarocks find these rocks trees to begin with.

@doronbehar
Copy link
Contributor

doronbehar commented Jun 15, 2019

I noticed that some packages which use Lua, (e.g AwesomeWM and Neovim) use an old version of Lua (5.2 && 5.1 - respectively). As a beginner Nixos user I'm not sure if it is easily override-able but I think it'd be worth mentioning that nixpkgs should use 5.3 as the default version of Lua for these packages' inputs.

@teto
Copy link
Member Author

teto commented Jun 16, 2019

why is that ? lua5.2 looks standard; 5.3 qnd 5.4 seem to have breaking changes. As for neovim they explicitly require 5.1

@doronbehar
Copy link
Contributor

doronbehar commented Jun 16, 2019

As for Neovim, you are correct but as for AwesomeWM, anything higher than 5.1 is fine. They both support LuaJIT as well.

I'm not sure what should be dictated as nixpkgs' policy but my opinion is that Lua 5.3 should be treated as the default as it's considered the latest version upstream. You are right that it has breaking changes and that's why Neovim Neovim explicitly requires 5.1 but this is an upstream issue, not nixpkgs'.

Additionally, I think that in the specific case of Neovim, since LuaJIT is supported as well I would switch to it for this package specifically, it is certainly seems superior then Lua 5.1, it's nice that it's build uses LuaJIT by default. but I think we should just rename the luaPackages name space to refer to lua53Packages. What do you think?

EDIT: The default Neovim build uses LuaJIT - it surprised me since it's inputs are lua and not luajit.

@teto
Copy link
Member Author

teto commented Sep 11, 2019

I suspect moving to lua53 would break many things. lua versions are different between eachother.

I've added the support in nix for luarocks mirrors so don't be surprised if luarocks-nix generates some strange urls. I've also moved the luarocks-nix repository to nix-community.
I had a qucik look at supporting luarocks test but seems like it deals with installed packages ? not too complex but just enough for me to skip it.
I wanted to take the opportunity to thank @Shados who improved the infra a lot ! I was able to tick many boxes thanks to his work !

@teto
Copy link
Member Author

teto commented Oct 15, 2019

@grwlf Many packages are marked broken in pkgs/applications/science/machine-learning/torch/torch-distro.nix . What do you think about replacing them with the current lua infrastructure ?
it unifies the interface and may unbreak some modules.
I can guide you if you have any questions.

@lblasc
Copy link
Contributor

lblasc commented Oct 15, 2019

@teto how about removing torch-distro completely? Sadly upstream didn't have any activity since 2017.

@teto teto mentioned this issue Oct 24, 2019
@stites
Copy link
Member

stites commented Oct 24, 2019

lua-torch is no longer maintained (the codebase was migrated to pytorch) and communities have been marked as non-existent. I think removing torch is valid. Doing so would also close #71888.

See https://github.com/torch/torch7#development-status
and final commit torch/torch7@dde9e56

@sergei-mironov
Copy link
Contributor

@teto Hi. I think it is OK to remove old torch files. I may be listed as a maintainer of some of them, but actually I don't plan to maintain anything because my focus shifted towards TF/pytorch nowdays..

@teto
Copy link
Member Author

teto commented Oct 24, 2019

ok thanks for the update. I guess we can remove it then. I was hoping someone
could move some of the packages to the current lua infra to salvage some of the
work (like finding the buildInputs). But that might not be worth the effort.
I don't plan to do anything as I have already other issues to address but I can
advise anyone interested in cleaning up.

teto added a commit to teto/nixpkgs that referenced this issue Feb 27, 2020
See NixOS#71888
and NixOS#56398

To sump up, development has moved on to other technologies than lua:
https://github.com/torch/torch7#development-status
and the current packages are broken anyway.
teto added a commit that referenced this issue Feb 28, 2020
See #71888
and #56398

To sump up, development has moved on to other technologies than lua:
https://github.com/torch/torch7#development-status
and the current packages are broken anyway.
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this issue Feb 29, 2020
See NixOS#71888
and NixOS#56398

To sump up, development has moved on to other technologies than lua:
https://github.com/torch/torch7#development-status
and the current packages are broken anyway.

(cherry picked from commit 05b6836)
nh2 pushed a commit to nh2/nixpkgs that referenced this issue Mar 28, 2020
See NixOS#71888
and NixOS#56398

To sump up, development has moved on to other technologies than lua:
https://github.com/torch/torch7#development-status
and the current packages are broken anyway.

(cherry picked from commit 05b6836)
stigok pushed a commit to stigok/nixpkgs that referenced this issue Jun 12, 2020
See NixOS#71888
and NixOS#56398

To sump up, development has moved on to other technologies than lua:
https://github.com/torch/torch7#development-status
and the current packages are broken anyway.

(cherry picked from commit 05b6836)
@stale
Copy link

stale bot commented Dec 6, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 6, 2020
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 28, 2021
@teto
Copy link
Member Author

teto commented Jul 28, 2021

@Mic92 @timokau with the rise of a the lua ecosystem with neovim 0.5, I am looking at ways to consolidate dependency management in that ecosystem (with #131499 for instance). The "maintainers/scripts/update-luarocks-packages: shellscript is not up to the task anymore so I was considerng adaptin pkgs/misc/vim-plugins/update.py and pluginupdate.py to generate pkgs/development/lua-modules/generated-packages.nix as well.
Any objection ?

@timokau
Copy link
Member

timokau commented Aug 12, 2021

Sorry for the late response. It has been a while since I touched the vim plugin infrastructure and I don't know much about lua. I think you're more up to date on both of these things than me, so I defer to you :)

@teto
Copy link
Member Author

teto commented Sep 2, 2021

status update:
I've recently merged :

While investigating how to reconcile vim plugins and lua packages, I found out this luarocks config element

-- to create a flat hierarchy
lua_modules_path = ""

that creates a flat hierarchy and could reduce the number of nested folders in our nix packages.

@teto
Copy link
Member Author

teto commented Oct 18, 2021

big changes in #140801 to remove the use of with self; in generated-packages.nix, like is done in haskell.

EDIT: fixed link

@doronbehar
Copy link
Contributor

big changes in #56398 to remove the use of with self; in generated-packages.nix, like is done in haskell.

@teto #56398 is this issue :).

@teto
Copy link
Member Author

teto commented Mar 30, 2022

#166162 fixes the issue we had on luv that was blocking luarocks to 3.2. We can now bump it to 3.8.
I had a nice PR that can automatically add neovim plugin dependencies #160484 (need a rebase) which could serve as a nice poc for https://github.com/nvim-lua/nvim-package-specification. To make it mergeable I would need to make it possible to generate flat lua installs.

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. I would welcome some help as I wont likely be able to do it anytime.

@teto
Copy link
Member Author

teto commented Oct 13, 2022

I've merged #195869 that adds a testing infra for the interpreter, which I hope will help prevent naive regressions in the future. I've also merged #195732 which should hopefully allow to have the best of both worlds for neovim plugins: automatic dependency management from the rockspec + uptodate plugins via the vim plugin updater.

Next step will be to track every per-package custom nix code for lua and replace it with code from the luaLib so that I can configure flat installs in luaLib and it will affect all of nixpkgs.

@Qyriad Qyriad added the 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems label May 26, 2024
@tomodachi94
Copy link
Member

Here's a GitHub Search query that can perhaps help with that: https://github.com/search?q=repo%3ANixOS%2Fnixpkgs+lang%3Anix+lua+NOT+wrapLuaPrograms+NOT+withPackages&type=code

There are definitely some false positives, but I'm also seeing some other packages could use some love.

@tomodachi94
Copy link
Member

More packages that could use TLC (pure Lua packages, most likely compatible with the neo-builders):

  • z-lua
  • vis
  • openrussian-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: lua
Projects
None yet
Development

No branches or pull requests

10 participants