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

buildLuarocksPackage: cannot build package that depends on luarocks #316009

Closed
mrcjkb opened this issue May 30, 2024 · 1 comment
Closed

buildLuarocksPackage: cannot build package that depends on luarocks #316009

mrcjkb opened this issue May 30, 2024 · 1 comment
Labels
0.kind: bug Something is broken 6.topic: lua

Comments

@mrcjkb
Copy link
Member

mrcjkb commented May 30, 2024

Describe the bug

luarocks exists as a luarocks package that other luarocks packages can depend on.
When trying to build a rockspec that depends on luarocks with buildLuarocksPackage, it fails.

-- rockspec dependencies
dependencies = {
  "lua >= 5.1",
  "luarocks",
}
       > Running phase: installPhase
       > Missing dependencies for testpackage scm-1:
       >    luarocks (not installed)
       >
       > testpackage scm-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
       > testpackage scm-1 depends on luarocks (not installed)
       > Warning: Failed searching manifest: Failed downloading https://luarocks.org/manifest-5.1 - no downloader tool available, 
please install wget or curl in your system
       >
       > Error: Could not satisfy dependency luarocks: No results matching query were found for Lua 5.1.
       For full logs, run 'nix log /nix/store/rnbmdmw05596619d3nsvzrwflqxh6gi6-lua5.1-testpackage-scm-1.drv'.

The rocks_trees entry in the generated luarocks config contains an entry for luarocks, but luarocks doesn't recognise it and tries to download the package instead.

Steps To Reproduce

I have created a repository to reproduce it with: https://github.com/mrcjkb/nix-luarocks-repro

  • Run nix build .#testpackage

A workaround is to use luarocks-nix to generate a buildLuarocksPackage expression for luarocks (luarocks nix luarocks),
and to add that package to the testpackage's propagatedBuildInputs instead of the luarocks package from nixpkgs.

Notify maintainers

@teto


Add a 👍 reaction to issues you find important.

@teto
Copy link
Member

teto commented May 31, 2024

thanks for creating the test repo, it's helpful. I've looked at the generated LUAROCKS_CONFIG and all looks good and I think luarocks just doesn't recognize the installed luarocks because of luarocks/luarocks#1659

My first thought would have been to rename the current luarocks into a luarocks_bootstrap and add a generated luarocks derivation, for which we could run the tests without the cyclic dependency luarocks -> busted -> luarocks.
While this might be the best outcome longterm, I am looking into the quickfix which would be to generate the manifest for the current luarocks

teto added a commit to teto/nixpkgs that referenced this issue May 31, 2024
When installing a lua package that depends on luarocks, luarocks was not
capable of recognizing the luarocks module: NixOS#316009 .

As explained here luarocks/luarocks#1659,
luarocks needs a manifest to recognize the package.
I first attempted to generate a manifest with `luarocks-admin
make-manifest` on our current manual luarocks derivation but this ended
up being too hackish as the `make-manifest` requires a .rockspec or
.rock to work, which we had not.

It seemed simpled to just rename the current manual luarocks derivation to luarocks_bootstrap
in order to break cyclic dependencies in buildLuarocksPackage and add a
generated luarocks derivation. Previously it was impossible to test
luarocks because of the cyclic dependency but we will now be able to
test the generated derivation.
@teto teto closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: lua
Projects
None yet
Development

No branches or pull requests

2 participants