lib/extend-lib.nix returns a nixpkg's lib extended with our own
helpers.
This is exposed as `helpers.extendedLib`, but when evaluating our
modules it should be assigned to `specialArgs.lib`.
Outside of our modules you must still access our helpers via
`config.lib.nixvim` or `config.lib.nixvim.extendedLib`.
Within helpers' sub-sections, `lib` is the extended lib.
Define `call = callPackageWith { inherit pkgs lib helpers; }`, which can
be used to automatically pass the correct args into helpers files.
`helpers` is passed in recursively.
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
Those types needed the following code in apply:
if builtins.isString value
then mkRaw value
else value
This commit avoids this boilerplate, and clarifies that the `str` is lua
code in the documentation.
This allows to avoid calling `mkRaw` on lua functions, as they will get
applied automatically.
This could also help in the future to refactor the use of Lua code to
make it more user-friendly.
With this change a user should be able to set raw lua code in more
places than before.
The `mkStr` helper was _not_ changed as a large number of places in
nixvim are using this helper to directly implement raw lua code.
Also note that types of the form `oneOf [submodule <something else>` are
not well rendered in the documentation, and should be avoided (this
includes `listOf [submodule <something else>`, so the helpers should be
avoided in this case)