Move the previous `default.nix` to `main.nix` so that `default.nix` can
be used for defining the set of all test derivations.
`main.nix` is imported by `default.nix`, but is only responsible for the
tests built from `tests/test-sources/`.
In the two places where our "helpers" lib is exclusively internal
(flake module args and building the docs), we no longer supply `pkgs`.
In the other 4 locations, we now note why we still do in a comment.
Splits everything that depends on a `pkgs` instance into an optional
attrs, allowing `helpers.nix` to be bootstrapped without `pkgs`.
This required some refactoring:
- `modules.specialArgs` is only available when `pkgs` is used
- `modules.specialArgsWith` now requires `defaultPkgs` be provided
- `builders.*` now have `*With` variants that take `pkgs` as an argument
and a `withPkgs` function that returns the old interface
- Had to define the fixed part of `builders` outside the attrs for now,
to avoid infinite recursion.
- The old `builders` are now deprecated, and print a warning when
evaluated
- `withOptoinalFns` was introduced to merge the optional attrs into the
final lib.
Add support for automatically importing any directories under
`plugins/by-name`.
Includes a validation test, which is run by CI and by the pre-commit hook.
The test ensures "package" options use a "literalExpression" in their
defaultText; i.e. it validates `lib.mkPackageOption` was used to build
the package options.
All options whose `default` is a derivation are covered by the test,
other than submodule sub-options.
Ensure `mkTestDerivationFromNixvimModule` correctly test warnings & assertions.
Also did some minor cleanup:
- Call `failing-tests.nix` using `pkgs.callPackage`
- Replace repetive use of `testBuildFailure` with a wrapper
`mkFailingNixvimTest`
Adds a regression test for #2076. This test ensures that
`extraConfigLua` is used in `finalPackage` and that the test will fail
correctly when running `nvim` results in unexpected output.
This moves most assertions out of generate-files and into a check
derivation. This should allow the CI to finish, even when there are
issues.
This also properly tests efmls, which was only checked partially before.
rust-analyzer is not covered because the existing assertions relate more
to edge-cases not handled by the generation script than the result it
builds.
Use `mkTestDerivationFromNixvimModule` instead of `mkTestDerivation`,
allowing "proper" modules to be used instead of plain attr configs.
This is useful for more complex tests that wish to use `config` or
`options` arguments, e.g:
```nix
{config, options, ...}: {
/* some cool test */
}
```
To allow `tests.dontRun` to be defined on such a test, the module is
allowed to be nested as `module`, e.g:
```nix
{
tests.dontRun = true;
module = {config, options, ...}: {
/* a disabled test */
};
}
```
Also ended up doing some general cleanup, removing an unused function,
etc.
This adds the `nixvimExtend` attribute to the generated standalone
derivation, this attribute takes a module as an argument and returns a
new standalone derivation with the initial module & the extended module
merged together.
In our basic template we used to provide a check based on
`mkTestDerivationFromNvim`. The issue with this check (that is handled
correctly internally) is that some plugins _can't_ be used in the test
environment, for example image.nvim like in #1085.
This commit introduces a new function to generate such checks,
`mkTestDerivationFromNixvimModule`, that wraps a nixvim configuration
instead of a built nvim instance.
Then a configuration can rely on the newly added
`helpers.enableExceptInTests` attribute to disable parts of the
configuration depending if it is evaluated in tests or in a real final
configuration.
Resolves#1085