Skip to content

Commit

Permalink
gerenate correct dependencies of neovim
Browse files Browse the repository at this point in the history
maintainers/scripts/update-luarocks-packages.sh > temp.nix
mv temp.nix pkgs/top-level/lua-generated-packages.nix

In order to run neovim tests, I switched on globally the compat flag of
lua5.2. I tried just overriding luaPackages.lua instead but it wouldn't
work.

running nix-shell -A neovim-local ~/nixpkgs --show-trace and
make functionaltest (you might need to run `export
	LUA_PATH="./?.lua;$LUA_PATH"` beforehand )

Results

[==========] 2734 tests from 278 test files ran. (273650.51 ms total)
[  PASSED  ] 2697 tests.

 11 SKIPPED TESTS
 6 FAILED TESTS
 26 ERRORS

Some of the errors might be due to lua incompatibilities but also the
tests might need some patching for nixos:

rovider/pythonx: Could not load Python 3:
python3 not found in search path or not executable.
python3.7 not found in search path or not executable.
python3.6 not found in search path or not executable.
python3.5 not found in search path or not executable.
python3.4 not found in search path or not executable.
python3.3 not found in search path or not executable.
python not found in search path or not executable.
  • Loading branch information
teto committed Jan 28, 2018
1 parent ac936d6 commit e77a7c7
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 275 deletions.
28 changes: 18 additions & 10 deletions maintainers/scripts/update-luarocks-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You'll likely want to use
# ``
# nixpkgs $ maintainers/scripts/update-luarocks-packages.sh pkgs/top-level/lua-generated-packages.nix
# nixpkgs $ maintainers/scripts/update-luarocks-packages.sh > pkgs/top-level/lua-generated-packages.nix
# ``
# to update all libraries in that folder.

Expand All @@ -16,11 +16,11 @@

# set -eu -o pipefail

if [ $# -lt 1 ]; then
# if [ $# -lt 1 ]; then

echo "Usage: $0 GENERATED_FILENAME"
exit 1
fi
# echo "Usage: $0 GENERATED_FILENAME"
# exit 1
# fi

GENERATED_NIXFILE="$1"

Expand Down Expand Up @@ -85,32 +85,40 @@ function convert_pkgs () {


declare -a pkg_list_main
declare -a pkg_list_extra
declare -a pkg_list_teto
declare -a pkg_list_hisham
pkg_list_main=(
ansicolors # -1.0.2-3
busted # -2.0.rc9-0 # OK
dkjson # -2.5-2 # looks ok
lua-cmsgpack # -0.4.0-0 # looks OK
lua_cliargs # -1.1-1 # OK
luassert # -1.7.9-0 # OK
lua-term # -0.7-1 #
luasocket # -2.0.2-6
ltermbox # -0.2-1 # ok
# mediator_lua # doesnt exist as source yet
luafilesystem # required by penlight
penlight
say # -1.3-1 # builtin type, check how luarocks handles modules
luv
luasystem
)
# ~/busted-2.0.rc12-1.rockspec

# basically don't have a src.pack version in
pkg_list_extra=(
pkg_list_teto=(
mediator_lua
mpack
nvim-client
busted # rc-3 won't work
luassert # cos wed need -1.7.10
)

pkg_list_hisham=(
coxpcall
)

echo "$HEADER"
convert_pkgs pkg_list_main
convert_pkgs pkg_list_extra "http://luarocks.org/manifests/teto"
convert_pkgs pkg_list_teto "http://luarocks.org/manifests/teto"
convert_pkgs pkg_list_hisham "https://luarocks.org/manifests/hisham"
echo "$FOOTER" # close the set
38 changes: 26 additions & 12 deletions pkgs/applications/editors/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ stdenv, fetchFromGitHub, cmake, gettext, libmsgpack, libtermkey
, libtool, libuv, luaPackages, ncurses, perl, pkgconfig
, libtool, libuv, ncurses, perl, pkgconfig
, unibilium, vimUtils, xsel, gperf, callPackage
, withJemalloc ? true, jemalloc
, luaPackages
}:

with stdenv.lib;
Expand Down Expand Up @@ -37,10 +38,25 @@ let
};
};

neovim = stdenv.mkDerivation rec {
name = "neovim-unwrapped-${version}";

# neovim doesn't take into account lua5.2 move of `unpack` to `table.unpack`
# so we need to compile lua5.2 with the compatibility flags
# doesn't work
# neovimLua = luaPackages.lua.override( { compat = true; });
neovimLua = luaPackages.lua;
# neovimLuaEnv = enableTests:
neovimLuaEnv =
neovimLua.withPackages(ps:
(with ps;
[ mpack lpeg luabitop ]
++ optionals true [ nvim-client luv lpeg coxpcall busted luafilesystem penlight ]));
in
stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "neovim-unwrapped";
version = "0.2.2";


src = fetchFromGitHub {
owner = "neovim";
repo = "neovim";
Expand All @@ -57,11 +73,12 @@ let
ncurses
neovimLibvterm
unibilium
luaPackages.lua
neovimLua
gperf
] ++ optional withJemalloc jemalloc
++ (with luaPackages; [ mpack lpeg luabitop ])
++ optionals doCheck (with luaPackages;[ nvim-client luv lpeg coxpcall busted luafilesystem penlight ]);
# todo creer un environnement
++ [ (neovimLuaEnv) ]
;

doCheck = true;

Expand All @@ -74,10 +91,10 @@ let
# current luajit interpret was not updated in nixos
cmakeFlags = [
"-DPREFER_LUA=ON"
"-DLUA_PRG=${luaPackages.lua}/bin/lua"
"-DLUA_PRG=${neovimLuaEnv}/bin/lua"
]
++ optionals doCheck (with luaPackages;[
"-DBUSTED_PRG=${luaPackages.busted}/bin/busted"
"-DBUSTED_PRG=${neovimLuaEnv}/bin/busted"
]);

# triggers on buffer overflow bug while running tests
Expand Down Expand Up @@ -116,7 +133,4 @@ let
maintainers = with maintainers; [ manveru garbas rvolosatovs ];
platforms = platforms.unix;
};
};

in
neovim
}
4 changes: 3 additions & 1 deletion pkgs/development/interpreters/lua-5/5.2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# look at setup hooks too
{ stdenv, fetchurl, readline
# compiles compatibility layer with lua5.1
, compat ? false
# fix the override problem then set it back to false
# set to true because of neovim
, compat ? true
, hostPlatform, makeWrapper
, lua-setup-hook, callPackage
, self
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/interpreters/lua-5/build-lua-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ builtins.removeAttrs attrs ["disabled" "checkInputs"] // {
# to prevent collisions when creating environments
# also added -f as it doesn't always exist
rm -rf $out/lib/luarocks
# don't remove the whole directory as
rm -rf $out/lib/luarocks/rocks/manifest
runHook postInstall
'';
Expand Down
12 changes: 10 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17485,9 +17485,17 @@ with pkgs;

wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { };

neovim-unwrapped = callPackage ../applications/editors/neovim {
neovim-unwrapped =
let
neovimLuaPackages = lua52Packages;
# does not work :/
# neovimLuaPackages = recurseIntoAttrs (callPackage ./lua-packages.nix { lua = lua5_2.override({ compat = true;}) ; });
in
callPackage ../applications/editors/neovim {
# only lua52 was modified thus we need to test against it
luaPackages = lua52Packages;
# we need compat = true else we have
# attempt to call global 'unpack' (a nil value)
luaPackages = neovimLuaPackages;
};

neovim = wrapNeovim neovim-unwrapped { };
Expand Down
Loading

0 comments on commit e77a7c7

Please sign in to comment.