neovim: test pure lua dependencies (#8991)

a revert of https://github.com/nix-community/home-manager/pull/8959 since we now relies on nixpkgs wrapper for that.

adding a test to avoid regressions. Choosing  telescope as starting point is https://github.com/nix-community/home-manager/issues/8787

I find the nmt test setup lacking: it doesnt set $PATH or $HOME (nvim
will error when it can't write into $HOME).
This commit is contained in:
Matthieu Coudron 2026-04-01 22:27:03 +02:00 committed by GitHub
parent 1ce9e62690
commit f21d8ebbc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View file

@ -34,6 +34,10 @@ lib.mkIf config.test.enableBig {
# to test passthru.initLua is taken into account
plugin = unicode-vim;
}
{
# test pure lua dependencies: telescope relies on the lua version of plenary
plugin = telescope-nvim;
}
];
extraLuaPackages = ps: [ ps.luautf8 ];
};
@ -48,15 +52,26 @@ lib.mkIf config.test.enableBig {
in
''
vimout=$(mktemp)
export PATH="$TESTED/home-path/bin:$PATH"
export HOME=$TMPDIR/hm-user
initLua="$TESTED/home-files/.config/nvim/init.lua"
echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | echo g:Unicode_data_directory | redir END" \
| ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \
| nvim -es -i NONE -u "$initLua" \
> "$vimout" || true
assertFileContains "$vimout" "HM_EXTRA_CONFIG"
assertFileContains "$vimout" "HM_PLUGINS_CONFIG"
# testing that unicode-vim's value is echoed
assertFileContains "$vimout" "autoload/unicode"
initLua="$TESTED/home-files/.config/nvim/init.lua"
# check telescope can find plenary/does not trigger any error
if ! nvim -V3log.txt -i NONE -es -u "$initLua" -c "lua require('plenary') " -c "quit"; then
fail "Could not require the 'plenary' dependency pulled by telescope.nvim"
cat log.txt
fi
assertFileContent $(normalizeStorePaths "$initLua") ${./plugin-config.expected}
# Verify generatedConfigs evaluated properly (issue #8371)