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
This commit is contained in:
Matthieu Coudron 2019-02-06 00:00:19 +09:00 committed by Michael Raskin
parent c15c4d76ce
commit aaeaa6d1c6
6 changed files with 68 additions and 33 deletions

View file

@ -1,6 +1,7 @@
ansicolors, ansicolors,
argparse, argparse,
dkjson dkjson
inspect
lrexlib-gnu, lrexlib-gnu,
lrexlib-posix, lrexlib-posix,
ltermbox, ltermbox,

1 ansicolors,
2 argparse,
3 dkjson
4 inspect
5 lrexlib-gnu,
6 lrexlib-posix,
7 ltermbox,

View file

@ -1,15 +1,25 @@
{ stdenv, fetchFromGitHub, cmake, gettext, msgpack, libtermkey, libiconv { stdenv, fetchFromGitHub, cmake, gettext, msgpack, libtermkey, libiconv
, libuv, luaPackages, ncurses, pkgconfig , libuv, lua, ncurses, pkgconfig
, unibilium, xsel, gperf , unibilium, xsel, gperf
, libvterm-neovim , libvterm-neovim
, withJemalloc ? true, jemalloc , withJemalloc ? true, jemalloc
, glibcLocales ? null, procps ? null
# now defaults to false because some tests can be flaky (clipboard etc)
, doCheck ? false
}: }:
with stdenv.lib; with stdenv.lib;
let let
neovimLuaEnv = lua.withPackages(ps:
neovim = stdenv.mkDerivation rec { (with ps; [ mpack lpeg luabitop ]
++ optionals doCheck [
nvim-client luv coxpcall busted luafilesystem penlight inspect
]
));
in
stdenv.mkDerivation rec {
name = "neovim-unwrapped-${version}"; name = "neovim-unwrapped-${version}";
version = "0.3.4"; version = "0.3.4";
@ -36,11 +46,20 @@ let
ncurses ncurses
libvterm-neovim libvterm-neovim
unibilium unibilium
luaPackages.lua
gperf gperf
neovimLuaEnv
] ++ optional withJemalloc jemalloc ] ++ optional withJemalloc jemalloc
++ optional stdenv.isDarwin libiconv ++ optional stdenv.isDarwin libiconv
++ lualibs; ++ optionals doCheck [ glibcLocales procps ]
;
inherit doCheck;
# to be exhaustive, one could run
# make oldtests too
checkPhase = ''
make functionaltest
'';
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
@ -48,10 +67,6 @@ let
pkgconfig 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 # nvim --version output retains compilation flags and references to build tools
postPatch = '' postPatch = ''
@ -61,9 +76,11 @@ let
disallowedReferences = [ stdenv.cc ]; disallowedReferences = [ stdenv.cc ];
cmakeFlags = [ cmakeFlags = [
"-DLUA_PRG=${luaPackages.lua}/bin/lua" "-DLUA_PRG=${neovimLuaEnv}/bin/lua"
"-DGPERF_PRG=${gperf}/bin/gperf" "-DGPERF_PRG=${gperf}/bin/gperf"
]; ]
++ optional doCheck "-DBUSTED_PRG=${neovimLuaEnv}/bin/busted"
;
# triggers on buffer overflow bug while running tests # triggers on buffer overflow bug while running tests
hardeningDisable = [ "fortify" ]; hardeningDisable = [ "fortify" ];
@ -81,6 +98,11 @@ let
$out/bin/nvim $out/bin/nvim
''; '';
# export PATH=$PWD/build/bin:${PATH}
shellHook=''
export VIMRUNTIME=$PWD/runtime
'';
meta = { meta = {
description = "Vim text editor fork focused on extensibility and agility"; description = "Vim text editor fork focused on extensibility and agility";
longDescription = '' longDescription = ''
@ -104,7 +126,4 @@ let
# https://nix-cache.s3.amazonaws.com/log/9ahcb52905d9d417zsskjpc331iailpq-neovim-unwrapped-0.2.2.drv # https://nix-cache.s3.amazonaws.com/log/9ahcb52905d9d417zsskjpc331iailpq-neovim-unwrapped-0.2.2.drv
broken = stdenv.isAarch64; broken = stdenv.isAarch64;
}; };
}; }
in
neovim

View file

@ -1,7 +1,7 @@
{ stdenv, fetchurl, fetchFromGitHub, makeWrapper { stdenv, fetchurl, fetchFromGitHub, makeWrapper
, docutils, perl, pkgconfig, python3, which, ffmpeg_4 , docutils, perl, pkgconfig, python3, which, ffmpeg_4
, freefont_ttf, freetype, libass, libpthreadstubs, mujs , freefont_ttf, freetype, libass, libpthreadstubs, mujs
, lua, luasocket, libuchardet, libiconv ? null, darwin , lua, libuchardet, libiconv ? null, darwin
, waylandSupport ? false , waylandSupport ? false
, wayland ? null , wayland ? null
@ -92,6 +92,8 @@ let
"http://www.freehackers.org/~tnagy/release/waf-${wafVersion}" ]; "http://www.freehackers.org/~tnagy/release/waf-${wafVersion}" ];
sha256 = "0j7sbn3w6bgslvwwh5v9527w3gi2sd08kskrgxamx693y0b0i3ia"; sha256 = "0j7sbn3w6bgslvwwh5v9527w3gi2sd08kskrgxamx693y0b0i3ia";
}; };
luaEnv = lua.withPackages(ps: with ps; [ luasocket]);
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "mpv-${version}"; name = "mpv-${version}";
version = "0.29.1"; version = "0.29.1";
@ -139,7 +141,7 @@ in stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
ffmpeg_4 freetype libass libpthreadstubs ffmpeg_4 freetype libass libpthreadstubs
lua luasocket libuchardet mujs luaEnv libuchardet mujs
] ++ optional alsaSupport alsaLib ] ++ optional alsaSupport alsaLib
++ optional archiveSupport libarchive ++ optional archiveSupport libarchive
++ optional bluraySupport libbluray ++ optional bluraySupport libbluray
@ -183,16 +185,9 @@ in stdenv.mkDerivation rec {
# Ensure youtube-dl is available in $PATH for mpv # Ensure youtube-dl is available in $PATH for mpv
wrapperFlags = wrapperFlags =
let
getPath = type : "${luasocket}/lib/lua/${lua.luaversion}/?.${type};" + ''--prefix PATH : "${luaEnv}/bin" \''
"${luasocket}/share/lua/${lua.luaversion}/?.${type}"; + optionalString youtubeSupport ''
luaPath = getPath "lua";
luaCPath = getPath "so";
in
''
--prefix LUA_PATH : "${luaPath}" \
--prefix LUA_CPATH : "${luaCPath}" \
'' + optionalString youtubeSupport ''
--prefix PATH : "${youtube-dl}/bin" \ --prefix PATH : "${youtube-dl}/bin" \
'' + optionalString vapoursynthSupport '' '' + optionalString vapoursynthSupport ''
--prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH" --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"

View file

@ -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 { lrexlib-gnu = buildLuarocksPackage {
pname = "lrexlib-gnu"; pname = "lrexlib-gnu";
version = "2.9.0-1"; version = "2.9.0-1";

View file

@ -18354,7 +18354,7 @@ in
}; };
mpv = callPackage ../applications/video/mpv rec { mpv = callPackage ../applications/video/mpv rec {
inherit (luaPackages) luasocket; inherit lua;
waylandSupport = stdenv.isLinux; waylandSupport = stdenv.isLinux;
alsaSupport = !stdenv.isDarwin; alsaSupport = !stdenv.isDarwin;
pulseSupport = !stdenv.isDarwin; pulseSupport = !stdenv.isDarwin;
@ -19816,7 +19816,7 @@ in
wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { };
neovim-unwrapped = callPackage ../applications/editors/neovim { neovim-unwrapped = callPackage ../applications/editors/neovim {
luaPackages = luajitPackages; lua = luajit;
}; };
neovim = wrapNeovim neovim-unwrapped { }; neovim = wrapNeovim neovim-unwrapped { };

View file

@ -972,7 +972,7 @@ with self; {
}; };
}; };
lgi = stdenv.mkDerivation rec { lgi = toLuaModule(stdenv.mkDerivation rec {
name = "lgi-${version}"; name = "lgi-${version}";
version = "0.9.2"; version = "0.9.2";
@ -1007,7 +1007,7 @@ with self; {
maintainers = with maintainers; [ lovek323 rasendubi ]; maintainers = with maintainers; [ lovek323 rasendubi ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
}; });
mpack = buildLuaPackage rec { mpack = buildLuaPackage rec {
name = "mpack-${version}"; name = "mpack-${version}";
@ -1105,7 +1105,7 @@ with self; {
}; };
}; };
vicious = stdenv.mkDerivation rec { vicious = toLuaModule(stdenv.mkDerivation rec {
name = "vicious-${version}"; name = "vicious-${version}";
version = "2.3.1"; version = "2.3.1";
@ -1131,7 +1131,7 @@ with self; {
maintainers = with maintainers; [ makefu mic92 ]; maintainers = with maintainers; [ makefu mic92 ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
}; });
}); });
in (lib.extends overrides packages) in (lib.extends overrides packages)