neovim: wrap in such a way as to avoid cross-compilation-specific patching

This commit is contained in:
Colin 2024-05-13 17:05:14 +00:00
parent 3d2babf2bb
commit 14202a5bcc
2 changed files with 55 additions and 48 deletions

View File

@ -103,54 +103,61 @@ in
# "use" # "use"
]; ];
# packageUnwrapped = config.programs.neovim.finalPackage; packageUnwrapped = let
packageUnwrapped = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (pkgs.neovimUtils.makeNeovimConfig { configArgs = {
withRuby = false; #< doesn't cross-compile w/o binfmt withRuby = false; #< doesn't cross-compile w/o binfmt
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
plugins = plugin-packages; plugins = plugin-packages;
customRC = '' customRC = ''
" let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc " let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc
" this used to be default, until <https://github.com/neovim/neovim/pull/19290> " this used to be default, until <https://github.com/neovim/neovim/pull/19290>
set mouse= set mouse=
" copy/paste to system clipboard " copy/paste to system clipboard
set clipboard=unnamedplus set clipboard=unnamedplus
" screw tabs; always expand them into spaces " screw tabs; always expand them into spaces
set expandtab set expandtab
" at least don't open files with sections folded by default " at least don't open files with sections folded by default
set nofoldenable set nofoldenable
" allow text substitutions for certain glyphs. " allow text substitutions for certain glyphs.
" higher number = more aggressive substitution (0, 1, 2, 3) " higher number = more aggressive substitution (0, 1, 2, 3)
" i only make use of this for tex, but it's unclear how to " i only make use of this for tex, but it's unclear how to
" apply that *just* to tex and retain the SyntaxRange stuff. " apply that *just* to tex and retain the SyntaxRange stuff.
set conceallevel=2 set conceallevel=2
" horizontal rule under the active line " horizontal rule under the active line
" set cursorline " set cursorline
" highlight trailing space & related syntax errors (doesn't seem to work??) " highlight trailing space & related syntax errors (doesn't seem to work??)
" let c_space_errors=1 " let c_space_errors=1
" let python_space_errors=1 " let python_space_errors=1
" enable highlighting of leading/trailing spaces, " enable highlighting of leading/trailing spaces,
" and especially tabs " and especially tabs
" source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/ " source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/
set list set list
set listchars=tab:\·,trail:·,extends:,precedes:,nbsp: set listchars=tab:\·,trail:·,extends:,precedes:,nbsp:
""""" PLUGIN CONFIG (vim) """"" PLUGIN CONFIG (vim)
${plugin-config-viml} ${plugin-config-viml}
""""" PLUGIN CONFIG (lua) """"" PLUGIN CONFIG (lua)
lua <<EOF lua <<EOF
${plugin-config-lua} ${plugin-config-lua}
EOF EOF
''; '';
}); };
in pkgs.wrapNeovimUnstable
pkgs.neovim-unwrapped
# XXX(2024/05/13): manifestRc must be null for cross-compilation to work.
# wrapper invokes `neovim` with all plugins enabled at build time i guess to generate caches and stuff?
# alternative is to emulate `nvim-wrapper` during build.
((pkgs.neovimUtils.makeNeovimConfig configArgs) // { manifestRc = null; })
;
# private because there could be sensitive things in the swap # private because there could be sensitive things in the swap
persist.byStore.private = [ ".cache/vim-swap" ]; persist.byStore.private = [ ".cache/vim-swap" ];

View File

@ -2094,15 +2094,15 @@ in with final; {
# }; # };
# fixes `hostPrograms.moby.neovim` (but breaks eval of `hostPkgs.moby.neovim` :o) # fixes `hostPrograms.moby.neovim` (but breaks eval of `hostPkgs.moby.neovim` :o)
wrapNeovimUnstable = neovim: config: (prev.wrapNeovimUnstable neovim config).overrideAttrs (upstream: { # wrapNeovimUnstable = neovim: config: (prev.wrapNeovimUnstable neovim config).overrideAttrs (upstream: {
# nvim wrapper has a sanity check that the plugins will load correctly. # # nvim wrapper has a sanity check that the plugins will load correctly.
# this is effectively a check phase and should be rewritten as such # # this is effectively a check phase and should be rewritten as such
postBuild = lib.replaceStrings # postBuild = lib.replaceStrings
[ "! $out/bin/nvim-wrapper" ] # [ "! $out/bin/nvim-wrapper" ]
# [ "${stdenv.hostPlatform.emulator buildPackages} $out/bin/nvim-wrapper" ] # # [ "${stdenv.hostPlatform.emulator buildPackages} $out/bin/nvim-wrapper" ]
[ "false && $out/bin/nvim-wrapper" ] # [ "false && $out/bin/nvim-wrapper" ]
upstream.postBuild; # upstream.postBuild;
}); # });
# 2023/07/30: upstreaming is blocked on unar (gnustep), unless i also make that optional # 2023/07/30: upstreaming is blocked on unar (gnustep), unless i also make that optional
xarchiver = mvToNativeInputs [ libxslt ] prev.xarchiver; xarchiver = mvToNativeInputs [ libxslt ] prev.xarchiver;