about summary refs log tree commit diff
path: root/pkgs/development/interpreters/lua-5
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-08-23 01:45:37 +0300
committerArtturin <Artturin@artturin.com>2022-08-26 20:04:02 +0300
commitec35f6341bc64bea3cfd4f384085c6c28f3590b8 (patch)
tree8232ec704612b0b138c30ded8fd7186768d5f33e /pkgs/development/interpreters/lua-5
parent613c4107502b9d9906584dec11487947bcc70c53 (diff)
lua-packages: try splicing
Diffstat (limited to 'pkgs/development/interpreters/lua-5')
-rw-r--r--pkgs/development/interpreters/lua-5/build-lua-package.nix12
-rw-r--r--pkgs/development/interpreters/lua-5/interpreter.nix9
2 files changed, 13 insertions, 8 deletions
diff --git a/pkgs/development/interpreters/lua-5/build-lua-package.nix b/pkgs/development/interpreters/lua-5/build-lua-package.nix
index 0af7b470b0b38..918bca2386392 100644
--- a/pkgs/development/interpreters/lua-5/build-lua-package.nix
+++ b/pkgs/development/interpreters/lua-5/build-lua-package.nix
@@ -1,10 +1,12 @@
 # Generic builder for lua packages
 { lib
 , lua
+, buildPackages
 , wrapLua
+, luarocks
 # Whether the derivation provides a lua module or not.
-, toLuaModule
 , luarocksCheckHook
+, luaLib
 }:
 
 {
@@ -82,7 +84,7 @@ let
   # configured trees)
   luarocks_config = "luarocks-config.lua";
   luarocks_content = let
-    generatedConfig = lua.pkgs.lib.generateLuarocksConfig {
+    generatedConfig = luaLib.generateLuarocksConfig {
       externalDeps = externalDeps ++ externalDepsGenerated;
       inherit extraVariables;
       inherit rocksSubdir;
@@ -107,14 +109,14 @@ let
     );
   externalDeps' = lib.filter (dep: !lib.isDerivation dep) externalDeps;
 
-  luarocksDrv = toLuaModule ( lua.stdenv.mkDerivation (
+  luarocksDrv = luaLib.toLuaModule ( lua.stdenv.mkDerivation (
 builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariables"] // {
 
   name = namePrefix + pname + "-" + version;
 
   nativeBuildInputs = [
     wrapLua
-    lua.pkgs.luarocks
+    luarocks
   ]
     ++ buildInputs
     ++ lib.optionals doCheck ([ luarocksCheckHook ] ++ checkInputs)
@@ -156,7 +158,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab
 
     nix_debug "Using LUAROCKS_CONFIG=$LUAROCKS_CONFIG"
 
-    LUAROCKS=${lua.pkgs.luarocks}/bin/luarocks
+    LUAROCKS=luarocks
     if (( ''${NIX_DEBUG:-0} >= 1 )); then
         LUAROCKS="$LUAROCKS --verbose"
     fi
diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix
index 1fb56851ce525..c392a2c3bb524 100644
--- a/pkgs/development/interpreters/lua-5/interpreter.nix
+++ b/pkgs/development/interpreters/lua-5/interpreter.nix
@@ -11,9 +11,12 @@
 , staticOnly ? stdenv.hostPlatform.isStatic
 }:
 let
+  luaversion = with sourceVersion; "${major}.${minor}";
+
   luaPackages = callPackage ../../lua-modules {
     lua = self;
     overrides = packageOverrides;
+    packagesAttr = "lua${lib.replaceChars ["."] ["_"] luaversion}.pkgs";
   };
 
 plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux"
@@ -28,7 +31,6 @@ plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux
 
 self = stdenv.mkDerivation rec {
   pname = "lua";
-  luaversion = with sourceVersion; "${major}.${minor}";
   version = "${luaversion}.${sourceVersion.patch}";
 
   src = fetchurl {
@@ -36,8 +38,8 @@ self = stdenv.mkDerivation rec {
     sha256 = hash;
   };
 
-  LuaPathSearchPaths    = luaPackages.lib.luaPathList;
-  LuaCPathSearchPaths   = luaPackages.lib.luaCPathList;
+  LuaPathSearchPaths    = luaPackages.luaLib.luaPathList;
+  LuaCPathSearchPaths   = luaPackages.luaLib.luaCPathList;
   setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths;
 
   nativeBuildInputs = [ makeWrapper ];
@@ -124,6 +126,7 @@ self = stdenv.mkDerivation rec {
   '';
 
   passthru = rec {
+    inherit luaversion;
     buildEnv = callPackage ./wrapper.nix {
       lua = self;
       inherit makeWrapper;