summaryrefslogtreecommitdiffstats
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2021-09-12 18:08:53 +0200
committerGitHub <noreply@github.com>2021-09-12 18:08:53 +0200
commitab9c7819fe57fbdbe352b9858497d21c7083d54c (patch)
treefd63cfcb343d07afd5d5989776a28950ee085fd1 /pkgs/top-level
parent3ca823aa9a102d16fe686b63103cb885747eec3b (diff)
parentb97977681eec4233bcc0428ccdd93a038f810ebf (diff)
Merge pull request #136615 from teto/lua-flat
Various lua changes/cleanup
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/all-packages.nix9
-rw-r--r--pkgs/top-level/lua-packages.nix89
2 files changed, 35 insertions, 63 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 694dbd04f0a6..748f70eefeef 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -19950,9 +19950,8 @@ with pkgs;
prosody = callPackage ../servers/xmpp/prosody {
# _compat can probably be removed on next minor version after 0.10.0
- lua5 = lua5_2_compat;
- withExtraLibs = [ luaPackages.luadbi-sqlite3 ];
- inherit (lua52Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent luadbi;
+ lua = lua5_2_compat;
+ withExtraLibs = [];
};
biboumi = callPackage ../servers/xmpp/biboumi { };
@@ -28277,9 +28276,7 @@ with pkgs;
neovim-remote = callPackage ../applications/editors/neovim/neovim-remote.nix { };
- vis = callPackage ../applications/editors/vis {
- inherit (lua52Packages) lpeg;
- };
+ vis = callPackage ../applications/editors/vis { };
viw = callPackage ../applications/editors/viw { };
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index 246d62b903b3..80f71dc1942e 100644
--- a/pkgs/top-level/lua-packages.nix
+++ b/pkgs/top-level/lua-packages.nix
@@ -18,85 +18,60 @@ let
packages = ( self:
let
- luaAtLeast = lib.versionAtLeast lua.luaversion;
- luaOlder = lib.versionOlder lua.luaversion;
- isLua51 = (lib.versions.majorMinor lua.version) == "5.1";
- isLua52 = (lib.versions.majorMinor lua.version) == "5.2";
- isLua53 = lua.luaversion == "5.3";
- isLuaJIT = lib.getName lua == "luajit";
- lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { };
-
- # Check whether a derivation provides a lua module.
- hasLuaModule = drv: drv ? luaModule ;
+ # a function of lua_path / lua_cpath
+ lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix {
+ inherit lib;
+ };
callPackage = pkgs.newScope self;
- requiredLuaModules = drvs: with lib; let
- modules = filter hasLuaModule drvs;
- in unique ([lua] ++ modules ++ concatLists (catAttrs "requiredLuaModules" modules));
-
- # Convert derivation to a lua module.
- toLuaModule = drv:
- drv.overrideAttrs( oldAttrs: {
- # Use passthru in order to prevent rebuilds when possible.
- passthru = (oldAttrs.passthru or {})// {
- luaModule = lua;
- requiredLuaModules = requiredLuaModules drv.propagatedBuildInputs;
- };
- });
-
-
- platformString =
- if stdenv.isDarwin then "macosx"
- else if stdenv.isFreeBSD then "freebsd"
- else if stdenv.isLinux then "linux"
- else if stdenv.isSunOS then "solaris"
- else throw "unsupported platform";
-
buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args );
- buildLuarocksPackage = with pkgs.lib; makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
- inherit toLuaModule;
+ buildLuarocksPackage = lib.makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
inherit lua;
+ inherit (pkgs) lib;
+ inherit (luaLib) toLuaModule;
});
-in
-with self; {
- getLuaPathList = majorVersion: [
- "share/lua/${majorVersion}/?.lua"
- "share/lua/${majorVersion}/?/init.lua"
- ];
- getLuaCPathList = majorVersion: [
- "lib/lua/${majorVersion}/?.so"
- ];
-
- # helper functions for dealing with LUA_PATH and LUA_CPATH
- getPath = drv: pathListForVersion:
- lib.concatMapStringsSep ";" (path: "${drv}/${path}") (pathListForVersion lua.luaversion);
- getLuaPath = drv: getPath drv getLuaPathList;
- getLuaCPath = drv: getPath drv getLuaCPathList;
+ luaLib = import ../development/lua-modules/lib.nix {
+ inherit (pkgs) lib;
+ inherit pkgs lua;
+ };
#define build lua package function
buildLuaPackage = callPackage ../development/lua-modules/generic {
- inherit lua writeText;
+ inherit writeText;
};
+ getPath = drv: pathListForVersion:
+ lib.concatMapStringsSep ";" (path: "${drv}/${path}") pathListForVersion;
- inherit toLuaModule hasLuaModule lua-setup-hook;
- inherit buildLuarocksPackage buildLuaApplication;
- inherit requiredLuaModules luaOlder luaAtLeast
- isLua51 isLua52 isLua53 isLuaJIT lua callPackage;
+in
+{
+ # helper functions for dealing with LUA_PATH and LUA_CPATH
+ lib = luaLib;
+
+ getLuaPath = drv: luaLib.getPath drv (luaLib.luaPathList lua.luaversion) ;
+ getLuaCPath = drv: luaLib.getPath drv (luaLib.luaCPathList lua.luaversion) ;
+
+
+ inherit lua lua-setup-hook callPackage;
+ inherit buildLuaPackage buildLuarocksPackage buildLuaApplication;
+ inherit (luaLib) luaOlder luaAtLeast isLua51 isLua52 isLua53 isLuaJIT
+ requiredLuaModules toLuaModule hasLuaModule;
# wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH
wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix {
- inherit lua; inherit (pkgs) makeSetupHook makeWrapper;
+ inherit lua lib;
+ inherit (pkgs) makeSetupHook makeWrapper;
};
luarocks = callPackage ../development/tools/misc/luarocks {
- inherit lua;
+ inherit lua lib;
};
+ # a fork of luarocks used to generate nix lua derivations from rockspecs
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
luxio = buildLuaPackage {
@@ -132,7 +107,7 @@ with self; {
};
};
- vicious = toLuaModule(stdenv.mkDerivation rec {
+ vicious = luaLib.toLuaModule( stdenv.mkDerivation rec {
pname = "vicious";
version = "2.5.0";