about summary refs log tree commit diff
path: root/pkgs/development/lua-modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-12-18 00:03:01 +0000
committerGitHub <noreply@github.com>2023-12-18 00:03:01 +0000
commit6ffc5a86039ae1e53a30738d6a671813d420d62f (patch)
tree8786783b5c14aa1378e33b3a12b9e7cd1a48e6ed /pkgs/development/lua-modules
parent543b819720cb5e17c32a34ceefd6ad71c7a62839 (diff)
parent92cdfb811993ecdf2c4b21738c2906119cf68b29 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/lua-modules')
-rw-r--r--pkgs/development/lua-modules/generated-packages.nix23
-rw-r--r--pkgs/development/lua-modules/updater/.flake86
-rw-r--r--pkgs/development/lua-modules/updater/default.nix23
-rwxr-xr-xpkgs/development/lua-modules/updater/updater.py8
4 files changed, 55 insertions, 5 deletions
diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix
index 435303833fe86..7b4f6b051a8fa 100644
--- a/pkgs/development/lua-modules/generated-packages.nix
+++ b/pkgs/development/lua-modules/generated-packages.nix
@@ -2753,6 +2753,29 @@ buildLuarocksPackage {
   };
 }) {};
 
+nlua = callPackage({ buildLuarocksPackage, fetchurl, fetchzip, lua, luaOlder }:
+buildLuarocksPackage {
+  pname = "nlua";
+  version = "0.1.0-1";
+  knownRockspec = (fetchurl {
+    url    = "mirror://luarocks/nlua-0.1.0-1.rockspec";
+    sha256 = "14ynhy85m2prawym1ap1kplkbicafbczpggzgdnji00frwqa1zvv";
+  }).outPath;
+  src = fetchzip {
+    url    = "https://github.com/mfussenegger/nlua/archive/v0.1.0.zip";
+    sha256 = "1x3pbv5ngbk0sjgwfpjsv3x49wzq4x29d9rm0hgyyb2g2mwag3jc";
+  };
+
+  disabled = (luaOlder "5.1");
+  propagatedBuildInputs = [ lua ];
+
+  meta = {
+    homepage = "https://github.com/mfussenegger/nlua";
+    description = "Neovim as Lua interpreter";
+    license.fullName = "GPL-3.0";
+  };
+}) {};
+
 nui-nvim = callPackage({ buildLuarocksPackage, fetchgit, fetchurl }:
 buildLuarocksPackage {
   pname = "nui.nvim";
diff --git a/pkgs/development/lua-modules/updater/.flake8 b/pkgs/development/lua-modules/updater/.flake8
new file mode 100644
index 0000000000000..16f76a43624cf
--- /dev/null
+++ b/pkgs/development/lua-modules/updater/.flake8
@@ -0,0 +1,6 @@
+[flake8]
+# E111 => 4 spaces tabs
+# don't let spaces else it is not recognized
+# E123 buggy
+ignore =
+	E501,E265,E402
diff --git a/pkgs/development/lua-modules/updater/default.nix b/pkgs/development/lua-modules/updater/default.nix
index 40c93b21e8318..e556d4d0dec92 100644
--- a/pkgs/development/lua-modules/updater/default.nix
+++ b/pkgs/development/lua-modules/updater/default.nix
@@ -6,10 +6,24 @@
 # , nix-prefetch-git
 , nix-prefetch-scripts
 , luarocks-nix
+, lua5_1
+, lua5_2
+, lua5_3
+, lua5_4
 }:
 let
 
-    path = lib.makeBinPath [ nix nix-prefetch-scripts luarocks-nix ];
+  path = lib.makeBinPath [
+    nix nix-prefetch-scripts luarocks-nix
+  ];
+
+  luaversions = [
+    lua5_1
+    lua5_2
+    lua5_3
+    lua5_4
+  ];
+
 in
 buildPythonApplication {
   pname = "luarocks-packages-updater";
@@ -34,7 +48,12 @@ buildPythonApplication {
     cp ${../../../../maintainers/scripts/pluginupdate.py} $out/lib/pluginupdate.py
 
     # wrap python scripts
-    makeWrapperArgs+=( --prefix PATH : "${path}" --prefix PYTHONPATH : "$out/lib" )
+    makeWrapperArgs+=( --prefix PATH : "${path}" --prefix PYTHONPATH : "$out/lib" \
+      --set LUA_51 ${lua5_1} \
+      --set LUA_52 ${lua5_2} \
+      --set LUA_53 ${lua5_3} \
+      --set LUA_54 ${lua5_4}
+    )
     wrapPythonProgramsIn "$out"
   '';
 
diff --git a/pkgs/development/lua-modules/updater/updater.py b/pkgs/development/lua-modules/updater/updater.py
index 89a9bd9823a72..3f1d27ab129f1 100755
--- a/pkgs/development/lua-modules/updater/updater.py
+++ b/pkgs/development/lua-modules/updater/updater.py
@@ -16,6 +16,8 @@ import csv
 import logging
 import textwrap
 from multiprocessing.dummy import Pool
+import pluginupdate
+from pluginupdate import update_plugins, FetchConfig
 
 from typing import List, Tuple, Optional
 from pathlib import Path
@@ -24,8 +26,6 @@ log = logging.getLogger()
 log.addHandler(logging.StreamHandler())
 
 ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))).parent.parent  # type: ignore
-import pluginupdate
-from pluginupdate import update_plugins, FetchConfig, CleanEnvironment
 
 PKG_LIST = "maintainers/scripts/luarocks-packages.csv"
 TMP_FILE = "$(mktemp)"
@@ -171,7 +171,6 @@ def generate_pkg_nix(plug: LuaPlugin):
     if plug.maintainers:
         cmd.append(f"--maintainers={plug.maintainers}")
 
-    # if plug.server == "src":
     if plug.src != "":
         if plug.src is None:
             msg = (
@@ -193,6 +192,9 @@ def generate_pkg_nix(plug: LuaPlugin):
 
     if plug.luaversion:
         cmd.append(f"--lua-version={plug.luaversion}")
+        luaver = plug.luaversion.replace('.', '')
+        if luaver := os.getenv(f"LUA_{luaver}"):
+            cmd.append(f"--lua-dir={luaver}")
 
     log.debug("running %s", " ".join(cmd))