neovim: fix cross to armv7l

This commit is contained in:
Colin 2024-06-07 07:31:44 +00:00
parent adc811efa1
commit 8807140c83

View File

@ -14,7 +14,8 @@ let
# docs: https://github.com/nvim-treesitter/nvim-treesitter
# config taken from: https://github.com/i077/system/blob/master/modules/home/neovim/default.nix
# this is required for tree-sitter to even highlight
plugin = nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars ++ [
# XXX(2024/06/03): `unison` removed because it doesn't cross compile
plugin = nvim-treesitter.withPlugins (_: (lib.filter (p: p.pname != "unison-grammar") nvim-treesitter.allGrammars) ++ [
# XXX: this is apparently not enough to enable syntax highlighting!
# nvim-treesitter ships its own queries which may be distinct from e.g. helix.
# the queries aren't included when i ship the grammar in this manner
@ -167,9 +168,27 @@ in
vim.mpack.decode = vim.mpack.unpack
vim.lpeg = require 'lpeg'
"
'' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace runtime/CMakeLists.txt --replace-fail \
'COMMAND $<TARGET_FILE:nvim_bin>' 'COMMAND ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} $<TARGET_FILE:nvim_bin>'
''
# + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# # required for x86_64 -> aarch64 (and probably armv7l too)
# substituteInPlace runtime/CMakeLists.txt --replace-fail \
# 'COMMAND $<TARGET_FILE:nvim_bin>' 'COMMAND ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} $<TARGET_FILE:nvim_bin>'
# ''
+ ''
# disable translations and syntax highlighting of .vim files because they don't cross x86_64 -> armv7l
substituteInPlace src/nvim/CMakeLists.txt --replace-fail \
'add_subdirectory(po)' '# add_subdirectory(po)'
# substituteInPlace src/nvim/po/CMakeLists.txt --replace-fail \
# 'add_dependencies(nvim nvim_translations)' '# add_dependencies(nvim nvim_translations)'
substituteInPlace runtime/CMakeLists.txt \
--replace-fail ' ''${GENERATED_SYN_VIM}' ' # ''${GENERATED_SYN_VIM}' \
--replace-fail ' ''${GENERATED_HELP_TAGS}' ' # ''${GENERATED_HELP_TAGS}' \
--replace-fail 'FILES ''${GENERATED_HELP_TAGS} ''${BUILDDOCFILES}' 'FILES ''${CMAKE_CURRENT_SOURCE_DIR}/nvim.desktop' \
--replace-fail 'FILES ''${GENERATED_SYN_VIM}' 'FILES ''${CMAKE_CURRENT_SOURCE_DIR}/nvim.desktop' \
--replace-fail 'if(''${PACKNAME}_DOC_FILES)' 'if(false)'
# --replace-fail ' ''${GENERATED_PACKAGE_TAGS}' ' # ''${GENERATED_PACKAGE_TAGS}' \
# --replace-fail 'list(APPEND BUILDDOCFILES' '# list(APPEND BUILDDOCFILES'
# --replace-fail ' FILES ''${GENERATED_HELP_TAGS} ' ' FILES ' \
'';
});
in pkgs.wrapNeovimUnstable