summary refs log tree commit diff
path: root/pkgs/development/lua-modules/lib.nix
diff options
context:
space:
mode:
authorMatthieu Coudron <886074+teto@users.noreply.github.com>2023-07-07 16:26:00 +0200
committerMatthieu Coudron <886074+teto@users.noreply.github.com>2023-07-08 19:56:05 +0200
commitd87a6a99f6dca40f54ec8e325c045afcb450066f (patch)
treed8da25efd8952e75ad8f63e244f356161b906e37 /pkgs/development/lua-modules/lib.nix
parent31c88af5e6c52178667417fd8404511da9f93686 (diff)
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
Diffstat (limited to 'pkgs/development/lua-modules/lib.nix')
-rw-r--r--pkgs/development/lua-modules/lib.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/development/lua-modules/lib.nix b/pkgs/development/lua-modules/lib.nix
index bdf363fb47999..7c7ffcccf2639 100644
--- a/pkgs/development/lua-modules/lib.nix
+++ b/pkgs/development/lua-modules/lib.nix
@@ -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