about summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim
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/applications/editors/neovim
parentc15c4d76ce8f9d295a0ee297dec614ed6fcaa422 (diff)
downloadnixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar
nixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.gz
nixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.bz2
nixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.lz
nixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.xz
nixlib-aaeaa6d1c6052938c302c07407e441e5b5794e48.tar.zst
nixlib-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/applications/editors/neovim')
-rw-r--r--pkgs/applications/editors/neovim/default.nix49
1 files changed, 34 insertions, 15 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix
index d7932dc4dcfc..ee7a79517850 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
+  }