nix-community.nixvim/lib/check.nix
traxys bf042c5809
tests: Fix netman tests by including docker (#267)
Netman tries to call 'docker -v' and it hangs neovim if the docker
command is not found. This adds the docker binary to the derivation
running checks
2023-03-17 13:43:17 +01:00

35 lines
791 B
Nix

{pkgs, ...}: {
checkNvim = {
name,
nvim,
dontRun,
...
}:
pkgs.stdenv.mkDerivation {
name = name;
nativeBuildInputs = [nvim pkgs.docker-client];
dontUnpack = true;
# We need to set HOME because neovim will try to create some files
#
# Because neovim does not return an exitcode when quitting we need to check if there are
# errors on stderr
buildPhase =
if !dontRun
then ''
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null)
if [[ -n $output ]]; then
echo "ERROR: $output"
exit 1
fi
''
else ''
'';
# If we don't do this nix is not happy
installPhase = ''
mkdir $out
'';
};
}