diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index 1990d31ae0d8..693d34d9d909 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -64,26 +64,29 @@ stdenv.mkDerivation ( })) else luapkgs.lpeg; - requiredLuaPkgs = + runtimeLuaPkgs = ps: [ + (nvim-lpeg-dylib ps) + ps.luabitop + ps.mpack + ]; + checkLuaPkgs = ps: - ( - with ps; - [ - (nvim-lpeg-dylib ps) - luabitop - mpack - ] - ++ lib.optionals finalAttrs.finalPackage.doCheck [ - luv - coxpcall - busted - luafilesystem - penlight - inspect - ] - ); - neovimLuaEnv = lua.withPackages requiredLuaPkgs; - neovimLuaEnvOnBuild = lua.luaOnBuild.withPackages requiredLuaPkgs; + runtimeLuaPkgs ps + ++ (with ps; [ + luv + coxpcall + busted + luafilesystem + penlight + inspect + ]); + # neovimLuaEnv ends up in buildInputs and its lib path is baked into the + # nvim binary, so it must only contain runtime modules; otherwise + # busted -> luarocks -> cmake leak into the runtime closure. + neovimLuaEnv = lua.withPackages runtimeLuaPkgs; + neovimLuaEnvOnBuild = lua.luaOnBuild.withPackages ( + if finalAttrs.finalPackage.doCheck then checkLuaPkgs else runtimeLuaPkgs + ); codegenLua = if lua.luaOnBuild.pkgs.isLuaJIT then let @@ -207,7 +210,15 @@ stdenv.mkDerivation ( -e "s|\$