mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
Since cbd1003d9d
I'm able to add _some_
invalid config definitions to modules the tests are using and get no
build error.
For example `extraConfigLua = null;` should produce an invalid type
error, but doesn't.
One less visible change in that commit is the move away from using the
"standalone" wrapper (`makeNixvimWithModule`), which implicitly sets
`wrapRc = true`.
Adding back `wrapRc` to the tests seems to fix the issue, however this
makes me wonder if there's an underlying issue with wrapping/not-wrapping?
Perhaps we've simply uncovered a long-standing eval issue that is masked
over by using `wrapRc`?
77 lines
2.2 KiB
Nix
77 lines
2.2 KiB
Nix
{
|
|
pkgs,
|
|
lib ? pkgs.lib,
|
|
...
|
|
}:
|
|
let
|
|
defaultPkgs = pkgs;
|
|
|
|
# Create a nix derivation from a nixvim executable.
|
|
# The build phase simply consists in running the provided nvim binary.
|
|
mkTestDerivationFromNvim =
|
|
{
|
|
name,
|
|
nvim,
|
|
# TODO: Deprecated 2024-08-20, remove after 24.11
|
|
dontRun ? false,
|
|
...
|
|
}@args:
|
|
let
|
|
# FIXME: this doesn't support helpers.enableExceptInTests, a context option would be better
|
|
result = nvim.extend {
|
|
config.test =
|
|
{
|
|
inherit name;
|
|
}
|
|
// lib.optionalAttrs (args ? dontRun) (
|
|
lib.warn
|
|
"mkTestDerivationFromNvim: the `dontRun` argument is deprecated. You should use the `test.runNvim` module option instead."
|
|
{ runNvim = !dontRun; }
|
|
);
|
|
};
|
|
in
|
|
result.config.test.derivation;
|
|
|
|
# Create a nix derivation from a nixvim configuration.
|
|
# The build phase simply consists in running neovim with the given configuration.
|
|
mkTestDerivationFromNixvimModule =
|
|
{
|
|
name ? null,
|
|
pkgs ? defaultPkgs,
|
|
module,
|
|
extraSpecialArgs ? { },
|
|
# TODO: Deprecated 2024-08-20, remove after 24.11
|
|
dontRun ? false,
|
|
}@args:
|
|
let
|
|
helpers = import ../lib/helpers.nix {
|
|
inherit pkgs lib;
|
|
# TODO: deprecate helpers.enableExceptInTests,
|
|
# add a context option e.g. `config.isTest`?
|
|
_nixvimTests = true;
|
|
};
|
|
|
|
result = helpers.modules.evalNixvim {
|
|
modules = [
|
|
module
|
|
(lib.optionalAttrs (name != null) { test.name = name; })
|
|
(lib.optionalAttrs (args ? dontRun) (
|
|
lib.warn
|
|
"mkTestDerivationFromNixvimModule: the `dontRun` argument is deprecated. You should use the `test.runNvim` module option instead."
|
|
{ config.test.runNvim = !dontRun; }
|
|
))
|
|
{ wrapRc = true; }
|
|
];
|
|
extraSpecialArgs = {
|
|
defaultPkgs = pkgs;
|
|
} // extraSpecialArgs;
|
|
# Don't check assertions/warnings while evaluating nixvim config
|
|
# We'll let the test derivation handle that
|
|
check = false;
|
|
};
|
|
in
|
|
result.config.test.derivation;
|
|
in
|
|
{
|
|
inherit mkTestDerivationFromNvim mkTestDerivationFromNixvimModule;
|
|
}
|