summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMatthieu Coudron <coudron@iij.ad.jp>2019-02-06 00:00:19 +0900
committerMichael Raskin <7c6f434c@mail.ru>2019-02-05 15:00:19 +0000
commitaaeaa6d1c6052938c302c07407e441e5b5794e48 (patch)
treeb886984d40101e65aa2321dedc50eee00bce31c6 /pkgs
parentc15c4d76ce8f9d295a0ee297dec614ed6fcaa422 (diff)
downloadnixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.gz
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.bz2
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.lz
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.xz
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.zst
nixpkgs-aaeaa6d1c6052938c302c07407e441e5b5794e48.zip
Add checkPhase for neovim (disabled by default) (#55266)
* neovim-unwrapped: now use lua environments

* mpv: use lua environments

* luaPackages.inspect: init at 3.1.1-0

* luaPackages.lgi: mark as a lua module

* luaPackages.vicious: mark as a lua module
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/editors/neovim/default.nix49
-rw-r--r--pkgs/applications/video/mpv/default.nix19
-rw-r--r--pkgs/development/lua-modules/generated-packages.nix20
-rw-r--r--pkgs/top-level/all-packages.nix4
-rw-r--r--pkgs/top-level/lua-packages.nix8
5 files changed, 67 insertions, 33 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix
index d7932dc4dcf..ee7a7951785 100644
--- a/pkgs/applications/editors/neovim/default.nix
+++ b/pkgs/applications/editors/neovim/default.nix
@@ -1,15 +1,25 @@
 { stdenv, fetchFromGitHub, cmake, gettext, msgpack, libtermkey, libiconv
-, libuv, luaPackages, ncurses, pkgconfig
+, libuv, lua, ncurses, pkgconfig
 , unibilium, xsel, gperf
 , libvterm-neovim
 , withJemalloc ? true, jemalloc
+, glibcLocales ? null, procps ? null
+
+# now defaults to false because some tests can be flaky (clipboard etc)
+, doCheck ? false
 }:
 
 with stdenv.lib;
 
 let
-
-  neovim = stdenv.mkDerivation rec {
+  neovimLuaEnv = lua.withPackages(ps:
+    (with ps; [ mpack lpeg luabitop ]
+    ++ optionals doCheck [
+        nvim-client luv coxpcall busted luafilesystem penlight inspect
+      ]
+    ));
+in
+  stdenv.mkDerivation rec {
     name = "neovim-unwrapped-${version}";
     version = "0.3.4";
 
@@ -36,11 +46,20 @@ let
       ncurses
       libvterm-neovim
       unibilium
-      luaPackages.lua
       gperf
+      neovimLuaEnv
     ] ++ optional withJemalloc jemalloc
       ++ optional stdenv.isDarwin libiconv
-      ++ lualibs;
+      ++ optionals doCheck [ glibcLocales procps ]
+    ;
+
+    inherit doCheck;
+
+    # to be exhaustive, one could run
+    # make oldtests too
+    checkPhase = ''
+      make functionaltest
+    '';
 
     nativeBuildInputs = [
       cmake
@@ -48,10 +67,6 @@ let
       pkgconfig
     ];
 
-    LUA_PATH = stdenv.lib.concatStringsSep ";" (map luaPackages.getLuaPath lualibs);
-    LUA_CPATH = stdenv.lib.concatStringsSep ";" (map luaPackages.getLuaCPath lualibs);
-
-    lualibs = [ luaPackages.mpack luaPackages.lpeg luaPackages.luabitop ];
 
     # nvim --version output retains compilation flags and references to build tools
     postPatch = ''
@@ -61,9 +76,11 @@ let
     disallowedReferences = [ stdenv.cc ];
 
     cmakeFlags = [
-      "-DLUA_PRG=${luaPackages.lua}/bin/lua"
+      "-DLUA_PRG=${neovimLuaEnv}/bin/lua"
       "-DGPERF_PRG=${gperf}/bin/gperf"
-    ];
+    ]
+    ++ optional doCheck "-DBUSTED_PRG=${neovimLuaEnv}/bin/busted"
+    ;
 
     # triggers on buffer overflow bug while running tests
     hardeningDisable = [ "fortify" ];
@@ -81,6 +98,11 @@ let
                 $out/bin/nvim
     '';
 
+    # export PATH=$PWD/build/bin:${PATH}
+    shellHook=''
+      export VIMRUNTIME=$PWD/runtime
+    '';
+
     meta = {
       description = "Vim text editor fork focused on extensibility and agility";
       longDescription = ''
@@ -104,7 +126,4 @@ let
       # https://nix-cache.s3.amazonaws.com/log/9ahcb52905d9d417zsskjpc331iailpq-neovim-unwrapped-0.2.2.drv
       broken = stdenv.isAarch64;
     };
-  };
-
-in
-  neovim
+  }
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index 4e4c623ca60..ffbaa9fffdf 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, fetchFromGitHub, makeWrapper
 , docutils, perl, pkgconfig, python3, which, ffmpeg_4
 , freefont_ttf, freetype, libass, libpthreadstubs, mujs
-, lua, luasocket, libuchardet, libiconv ? null, darwin
+, lua, libuchardet, libiconv ? null, darwin
 
 , waylandSupport ? false
   , wayland           ? null
@@ -92,6 +92,8 @@ let
              "http://www.freehackers.org/~tnagy/release/waf-${wafVersion}" ];
     sha256 = "0j7sbn3w6bgslvwwh5v9527w3gi2sd08kskrgxamx693y0b0i3ia";
   };
+  luaEnv = lua.withPackages(ps: with ps; [ luasocket]);
+
 in stdenv.mkDerivation rec {
   name = "mpv-${version}";
   version = "0.29.1";
@@ -139,7 +141,7 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [
     ffmpeg_4 freetype libass libpthreadstubs
-    lua luasocket libuchardet mujs
+    luaEnv libuchardet mujs
   ] ++ optional alsaSupport        alsaLib
     ++ optional archiveSupport     libarchive
     ++ optional bluraySupport      libbluray
@@ -183,16 +185,9 @@ in stdenv.mkDerivation rec {
 
   # Ensure youtube-dl is available in $PATH for mpv
   wrapperFlags =
-  let
-    getPath  = type : "${luasocket}/lib/lua/${lua.luaversion}/?.${type};" +
-                      "${luasocket}/share/lua/${lua.luaversion}/?.${type}";
-    luaPath  = getPath "lua";
-    luaCPath = getPath "so";
-  in
-  ''
-      --prefix LUA_PATH : "${luaPath}" \
-      --prefix LUA_CPATH : "${luaCPath}" \
-  '' + optionalString youtubeSupport ''
+
+    ''--prefix PATH : "${luaEnv}/bin" \''
+  + optionalString youtubeSupport ''
       --prefix PATH : "${youtube-dl}/bin" \
   '' + optionalString vapoursynthSupport ''
       --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"
diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix
index 353eaa6e960..dc15a7a9ad6 100644
--- a/pkgs/development/lua-modules/generated-packages.nix
+++ b/pkgs/development/lua-modules/generated-packages.nix
@@ -70,6 +70,26 @@ dkjson = buildLuarocksPackage {
     };
   };
 };
+inspect = buildLuarocksPackage {
+  pname = "inspect";
+  version = "3.1.1-0";
+
+  src =  fetchurl {
+      url    = https://luarocks.org/inspect-3.1.1-0.src.rock;
+      sha256 = "0k4g9ahql83l4r2bykfs6sacf9l1wdpisav2i0z55fyfcdv387za";
+   };
+  disabled = ( luaOlder "5.1");
+  propagatedBuildInputs = [lua  ];
+  buildType="builtin";
+
+  meta = {
+    homepage = "https://github.com/kikito/inspect.lua";
+    description="Lua table visualizer, ideal for debugging";
+    license = {
+      fullName = "MIT <http://opensource.org/licenses/MIT>";
+    };
+  };
+};
 lrexlib-gnu = buildLuarocksPackage {
   pname = "lrexlib-gnu";
   version = "2.9.0-1";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index bdd54e2ea9c..a1adb32cded 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18354,7 +18354,7 @@ in
     };
 
   mpv = callPackage ../applications/video/mpv rec {
-    inherit (luaPackages) luasocket;
+    inherit lua;
     waylandSupport     = stdenv.isLinux;
     alsaSupport        = !stdenv.isDarwin;
     pulseSupport       = !stdenv.isDarwin;
@@ -19816,7 +19816,7 @@ in
   wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { };
 
   neovim-unwrapped = callPackage ../applications/editors/neovim {
-    luaPackages = luajitPackages;
+    lua = luajit;
   };
 
   neovim = wrapNeovim neovim-unwrapped { };
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index 11e05b504b4..de68c139dc2 100644
--- a/pkgs/top-level/lua-packages.nix
+++ b/pkgs/top-level/lua-packages.nix
@@ -972,7 +972,7 @@ with self; {
     };
   };
 
-  lgi = stdenv.mkDerivation rec {
+  lgi = toLuaModule(stdenv.mkDerivation rec {
     name = "lgi-${version}";
     version = "0.9.2";
 
@@ -1007,7 +1007,7 @@ with self; {
       maintainers = with maintainers; [ lovek323 rasendubi ];
       platforms   = platforms.unix;
     };
-  };
+  });
 
   mpack = buildLuaPackage rec {
     name = "mpack-${version}";
@@ -1105,7 +1105,7 @@ with self; {
     };
   };
 
-  vicious = stdenv.mkDerivation rec {
+  vicious = toLuaModule(stdenv.mkDerivation rec {
     name = "vicious-${version}";
     version = "2.3.1";
 
@@ -1131,7 +1131,7 @@ with self; {
       maintainers = with maintainers; [ makefu mic92 ];
       platforms   = platforms.linux;
     };
-  };
+  });
 
 });
 in (lib.extends overrides packages)