{ lib, stdenv, fetchFromGitHub, cmake, gettext, msgpack-c, libtermkey, libiconv , libuv, lua, ncurses, pkg-config , unibilium, gperf , libvterm-neovim , tree-sitter , fetchurl , buildPackages , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } , CoreServices , glibcLocales ? null, procps ? null # now defaults to false because some tests can be flaky (clipboard etc), see # also: https://github.com/neovim/neovim/issues/16233 , doCheck ? false , nodejs ? null, fish ? null, python3 ? null }: let requiredLuaPkgs = ps: (with ps; [ lpeg luabitop mpack ] ++ lib.optionals doCheck [ nvim-client luv coxpcall busted luafilesystem penlight inspect ] ); neovimLuaEnv = lua.withPackages requiredLuaPkgs; neovimLuaEnvOnBuild = lua.luaOnBuild.withPackages requiredLuaPkgs; codegenLua = if lua.luaOnBuild.pkgs.isLuaJIT then let deterministicLuajit = lua.luaOnBuild.override { deterministicStringIds = true; self = deterministicLuajit; }; in deterministicLuajit.withPackages(ps: [ ps.mpack ps.lpeg ]) else lua.luaOnBuild; pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]); in stdenv.mkDerivation rec { pname = "neovim-unwrapped"; version = "0.9.1"; src = fetchFromGitHub { owner = "neovim"; repo = "neovim"; rev = "v${version}"; hash = "sha256-G51qD7GklEn0JrneKSSqDDx0Odi7W2FjdQc0ZDE9ZK4="; }; patches = [ # introduce a system-wide rplugin.vim in addition to the user one # necessary so that nix can handle `UpdateRemotePlugins` for the plugins # it installs. See https://github.com/neovim/neovim/issues/9413. ./system_rplugin_manifest.patch ]; dontFixCmake = true; inherit lua; buildInputs = [ gperf libtermkey libuv libvterm-neovim # This is actually a c library, hence it's not included in neovimLuaEnv, # see: # https://github.com/luarocks/luarocks/issues/1402#issuecomment-1080616570 # and it's definition at: pkgs/development/lua-modules/overrides.nix lua.pkgs.libluv msgpack-c ncurses neovimLuaEnv tree-sitter unibilium ] ++ lib.optionals stdenv.isDarwin [ libiconv CoreServices ] ++ lib.optionals doCheck [ glibcLocales procps ] ; inherit doCheck; # to be exhaustive, one could run # make oldtests too checkPhase = '' make functionaltest ''; nativeBuildInputs = [ cmake gettext pkg-config ]; # extra programs test via `make functionaltest` nativeCheckInputs = [ fish nodejs pyEnv # for src/clint.py ]; # nvim --version output retains compilation flags and references to build tools postPatch = '' substituteInPlace src/nvim/version.c --replace NVIM_VERSION_CFLAGS ""; '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' sed -i runtime/CMakeLists.txt \ -e "s|\".*/bin/nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g" sed -i src/nvim/po/CMakeLists.txt \ -e "s|\$