luarocks: can be embedded with lua.withPackages

lua.withPackages only brings packages that have passthru.luaModule, which was not the case of luarocks (because it's built differently than other lua packages). We call toLuaModule on luarocks so that it is brought in a lua.withPackages call
This commit is contained in:
Matthieu Coudron 2023-07-07 16:26:00 +02:00
parent 31c88af5e6
commit d87a6a99f6
2 changed files with 9 additions and 3 deletions

View file

@ -89,7 +89,13 @@ rec {
, rocksSubdir
}: let
rocksTrees = lib.imap0
(i: dep: { name = "dep-${toString i}"; root = "${dep}"; rocks_dir = "${dep}/${dep.rocksSubdir}"; })
(i: dep: {
name = "dep-${toString i}";
root = "${dep}";
# packages built by buildLuaPackage or luarocks doesn't contain rocksSubdir
# hence a default here
rocks_dir = if dep ? rocksSubdir then "${dep}/${dep.rocksSubdir}" else "${dep.pname}-${dep.version}-rocks";
})
requiredLuaRocks;
# Explicitly point luarocks to the relevant locations for multiple-output

View file

@ -54,10 +54,10 @@ rec {
inherit (pkgs.buildPackages) makeSetupHook makeWrapper;
};
luarocks = callPackage ../development/tools/misc/luarocks/default.nix { };
luarocks = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { });
# a fork of luarocks used to generate nix lua derivations from rockspecs
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { });
lua-resty-core = callPackage ({ fetchFromGitHub }: buildLuaPackage rec {
pname = "lua-resty-core";