From aaeaa6d1c6052938c302c07407e441e5b5794e48 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Wed, 6 Feb 2019 00:00:19 +0900 Subject: 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 --- pkgs/applications/editors/neovim/default.nix | 49 +++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'pkgs/applications/editors/neovim') 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 + } -- cgit 1.4.1