3
0
Fork 0
forked from mirrors/nixpkgs

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,
argparse,
dkjson
inspect
lrexlib-gnu,
lrexlib-posix,
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
, 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
}

View file

@ -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"

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

View file

@ -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 { };

View file

@ -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)