neovim: add a checkPhase in the wrapper

add a checkPhase (if doCheck == true, disabled by default) that tries to
start neovim and fails in case of errors. It allows to catch small
misconfiugurations before switching to a new config.
This commit is contained in:
Matthieu C. 2024-10-31 23:36:04 +01:00 committed by Matthieu Coudron
parent f937a3a20c
commit 31dc3e56e0
2 changed files with 18 additions and 2 deletions

View File

@ -55,11 +55,17 @@ let
nvim-with-luasnip = wrapNeovim2 "-with-luasnip" (makeNeovimConfig {
plugins = [ {
plugin = vimPlugins.luasnip;
}
];
});
# build should fail with a wrong
nvim-run-failing-check = (wrapNeovimUnstable neovim-unwrapped {
luaRcContent = "this is an invalid lua statement to break the build";
}).overrideAttrs({
doCheck = true;
});
nvimAutoDisableWrap = makeNeovimConfig { };
wrapNeovim2 = suffix: config:
@ -96,6 +102,9 @@ in
inherit nmt;
# Disabled because of https://github.com/NixOS/nixpkgs/pull/352727
# failed_check = pkgs.testers.testBuildFailure nvim-run-failing-check;
vim_empty_config = vimUtils.vimrcFile { beforePlugins = ""; customRC = ""; };
### neovim tests

View File

@ -61,7 +61,7 @@ let
stdenv.mkDerivation (finalAttrs:
let
pluginsNormalized = neovimUtils.normalizePlugins plugins;
pluginsNormalized = neovimUtils.normalizePlugins finalAttrs.plugins;
myVimPackage = neovimUtils.normalizedPluginsToVimPackage pluginsNormalized;
@ -250,6 +250,13 @@ let
# A Vim "package", see ':h packages'
vimPackage = myVimPackage;
checkPhase = ''
runHook preCheck
$out/bin/nvim -i NONE -e +quitall!
runHook postCheck
'';
passthru = {
inherit providerLuaRc packpathDirs;
unwrapped = neovim-unwrapped;