neovim-unwrapped: add optional wasmtime support
Add a wasmSupport override that enables Neovim's wasmtime integration and uses wasm-enabled tree-sitter while keeping defaults aligned with upstream.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
unibilium,
|
||||
utf8proc,
|
||||
tree-sitter,
|
||||
wasmtime_36,
|
||||
fetchurl,
|
||||
buildPackages,
|
||||
treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; },
|
||||
@@ -20,6 +21,7 @@
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
writableTmpDirAsHomeHook,
|
||||
wasmSupport ? false,
|
||||
|
||||
# now defaults to false because some tests can be flaky (clipboard etc), see
|
||||
# also: https://github.com/neovim/neovim/issues/16233
|
||||
@@ -30,6 +32,9 @@
|
||||
|
||||
let
|
||||
lua = if lib.meta.availableOn stdenv.hostPlatform luajit then luajit else lua5_1;
|
||||
treeSitterForNeovim = tree-sitter.override {
|
||||
inherit wasmSupport;
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (
|
||||
@@ -161,10 +166,13 @@ stdenv.mkDerivation (
|
||||
# and it's definition at: pkgs/development/lua-modules/overrides.nix
|
||||
lua.pkgs.libluv
|
||||
neovimLuaEnv
|
||||
tree-sitter
|
||||
treeSitterForNeovim
|
||||
unibilium
|
||||
utf8proc
|
||||
]
|
||||
++ lib.optionals wasmSupport [
|
||||
wasmtime_36
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.libc != "glibc") [
|
||||
# Provide libintl for non-glibc platforms
|
||||
gettext
|
||||
@@ -202,13 +210,20 @@ stdenv.mkDerivation (
|
||||
pyEnv # for src/clint.py
|
||||
];
|
||||
|
||||
# nvim --version output retains compilation flags and references to build tools
|
||||
postPatch = 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|\$<TARGET_FILE:nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g"
|
||||
'';
|
||||
postPatch =
|
||||
lib.optionalString wasmSupport ''
|
||||
substituteInPlace src/nvim/CMakeLists.txt \
|
||||
--replace-fail \
|
||||
'find_package(Wasmtime 36.0.6 EXACT REQUIRED)' \
|
||||
'find_package(Wasmtime REQUIRED)'
|
||||
''
|
||||
# nvim --version output retains compilation flags and references to build tools
|
||||
+ 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|\$<TARGET_FILE:nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g"
|
||||
'';
|
||||
# check that the above patching actually works
|
||||
disallowedRequisites = [
|
||||
stdenv.cc
|
||||
@@ -229,6 +244,12 @@ stdenv.mkDerivation (
|
||||
(lib.cmakeBool "ENABLE_TRANSLATIONS" true)
|
||||
(lib.cmakeBool "USE_BUNDLED_BUSTED" false)
|
||||
]
|
||||
++ lib.optionals wasmSupport [
|
||||
# FindWasmtime has no pkg-config fallback.
|
||||
(lib.cmakeBool "ENABLE_WASMTIME" true)
|
||||
(lib.cmakeFeature "WASMTIME_INCLUDE_DIR" "${lib.getDev wasmtime_36}/include")
|
||||
(lib.cmakeFeature "WASMTIME_LIBRARY" "${lib.getLib wasmtime_36}/lib/libwasmtime${stdenv.hostPlatform.extensions.sharedLibrary}")
|
||||
]
|
||||
++ (
|
||||
if lua.pkgs.isLuaJIT then
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user