Commit Graph
184 Commits
Author SHA1 Message Date
Gaetan Lepage 5a491f4b2b modules/performance: temporary add plenary to extraPlugins to fix tests 2025-04-01 16:03:03 +02:00
Gaetan Lepage 5d833a1692 plugins/packer: remove (deprecated) 2025-04-01 16:03:03 +02:00
Gaetan Lepage 77c5fe808a modules/lua-loader: use new 0.11 API for enabling/disabling 2025-04-01 16:03:03 +02:00
Gaetan Lepage efb24d78bd modules: refactor plugins code in top-level 2025-04-01 15:43:26 +02:00
Gaetan Lepage db01a0dd97 modules: add env option 2025-03-24 18:50:29 +01:00
Matt Sturgeon f99264c1fb modules/nixpkgs: don't assign elaborated platforms
See https://github.com/NixOS/nixpkgs/pull/376988
2025-02-04 23:57:58 +00:00
Gaetan Lepage 12e658eca8 treewide: use mkWarnings where possible 2025-01-29 15:57:14 +01:00
Matt Sturgeon 00586f8f1b modules/output: move symlinkJoin to build.package 2025-01-20 14:49:59 +00:00
Matt Sturgeon 82415eaa5d modules/nixpkgs: warn about changing defaults
If end-users change the nixpkgs revision to something other than our
default, they can run into issues not picked up by our test suite.
2025-01-19 13:13:15 +00:00
Matt Sturgeon 51474292cd modules/nixpkgs: remove pkgs default text 2025-01-17 10:16:10 +00:00
Matt Sturgeon 8c6f9ed8c4 lib/modules: allow specifying system as an evalNixvim arg 2025-01-17 10:16:10 +00:00
Matt Sturgeon 7790746d38 modules/nixpkgs: add useGlobalPackages option 2025-01-17 10:16:09 +00:00
Matt Sturgeon 912841c1a7 modules/nixpkgs: construct an instance of nixpkgs.source 2025-01-17 09:37:03 +00:00
Matt Sturgeon 8dc8fa38b0 modules/nixpkgs: add hostPlatform & buildPlatform options 2025-01-17 09:37:03 +00:00
Matt Sturgeon 5bd04ce09a modules/nixpkgs: add config option 2025-01-17 09:37:02 +00:00
Matt Sturgeon ff29c97723 modules/test: provide access to expect function
Allow `test.warnings` and `test.assertions` to be defined as either a
list, or a function coerced to a list.

When defined as a function, it is supplied an `expect` function which
provides some syntactic-sugar for defining simple expectations.

This is an alternative to the current approach of defining that `expect`
function on an ad-hoc basis.

I prefer this to adding `expect` to nixvim's lib because:
1. That would require having access to `lib`
2. IDK where in `lib` such a specialized function should live
2025-01-17 02:17:34 +00:00
Matt Sturgeon 5192a85f32 test/nixpkgs-module: use a fixed runCommand function
Rather than getting `runCommand` from the pkgs instance under test, get
the function from a fixed/consistent pkgs instance.
2025-01-16 02:55:01 +00:00
Matt Sturgeon 7854d5f18c modules/test: fix expectations lib.toJSON -> builtins.toJSON 2025-01-16 02:55:00 +00:00
Sandro Jäckel d608bccddd Replace runCommandNoCCLocal alias with runCommandLocal 2025-01-01 00:54:27 +00:00
Matt Sturgeon fc9176c75b modules/test: hide the deprecated check* options 2024-12-27 21:09:48 +00:00
Matt Sturgeon e5974b316d modules/test: document possible types for expectation value 2024-12-27 20:18:30 +00:00
Matt Sturgeon ae612f8249 tests: use warning-expectations options
Deprecated the old `test.check*` options.
2024-12-27 18:31:34 +00:00
Matt Sturgeon 24e3b11b23 modules/test: allow specifying expectation value type 2024-12-27 18:31:34 +00:00
Matt Sturgeon c2e172b0d3 modules/test: allow arbitrary warning/assertion expecations
Allow defining expectation predicates that will be tested on the final
warnings/assertions lists.
2024-12-27 18:31:34 +00:00
Matt Sturgeon e7dcc9b518 modules/test: allow not building nixvim config 2024-12-27 11:33:53 +00:00
Matt Sturgeon 8938e09db1 modules/output: add manDocsPackage 2024-12-23 12:18:06 +00:00
Matt Sturgeon 9487403532 modules/context: flake option, provides access to our flake 2024-12-23 12:18:06 +00:00
Jeremy Fleischman f3ef2721ab modules/keymap: quickfix, use "keep" rather than "error"
There are some codepaths out there in the wild that seem to be
explicitly setting a buffer at build time. I'm not convinced that's a
sane thing to do, but I don't have time to dig any further right now.

See the discussion starting here:
https://github.com/nix-community/nixvim/pull/2712#issuecomment-2556330101
for more context.
2024-12-20 01:54:02 -08:00
Jeremy Fleischman 79a637d196 modules/keymap: include buffer when registering keymapsOnEvents
This feels more correct to me: I believe we were registering a keymap
for all buffers, even if only some of them have experienced the relevant
autocmd.

I don't know if it's guaranteed here that `args.buf` always exists
(but maybe it's not a problem if it doesn't exist, because we'll still
register a keymap for all buffers?).

This fixes https://github.com/nix-community/nixvim/issues/2711
2024-12-18 23:04:09 +00:00
Gaetan Lepage 17905dec3d modules: let extraPlugins accept null values 2024-12-17 22:46:34 +01:00
Gaetan Lepage ec24d496d5 treewide (cleaning): helpers.toLuaObject -> lib.nixvim.toLuaObject 2024-12-15 21:55:51 +00:00
Matt Sturgeon bef9feb446 lib/modules: pass inputs.nixpkgs into evalNixvim
Expose our locked nixpkgs as the `nixpkgs.source` module options.

This only happens when `evalNixvim` is part of a lib that was provided
`flake` as an argument.

Stubbed the `nixpkgs.source` option for now. Eventually, this will be
used to construct `pkgs` internally. For now, it's purely informational.
2024-12-15 18:41:23 +00:00
Austin Horstman 76b567b43c modules/lazyload: warn enabling a lazy loading provider 2024-12-10 10:15:10 -06:00
Matt Sturgeon 6348336db0 modules/lazyload: init w/ assertion
Adds a global lazyloading assertion. No module options yet.
2024-12-05 20:48:04 +00:00
Gaetan Lepage ed30fd8588 modules/opts: fix code generation condition to prevent false positives
Currently, we generate the lua code as soon as the value of the option
is not an empty attrs.
However, a case where the attrs only contains `null` values
(`nord_colorscheme = null; nord_foo = null;}` would pass the `if`
condition, but the generated lua table would still be empty because
`toLua` filters out those values.

Hence, we should directly check if the attrs would be translated to an
empty lua table or not to decide whether we should generate the lua
snippet or not.
2024-11-20 16:30:09 +01:00
Heitor Augusto ef8d57aba0 modules/clipboard: allow raw lua code in register option 2024-11-15 18:40:10 +00:00
Heitor Augusto d100a4e994 modules/output: expose withPython3 2024-11-13 16:23:27 -03:00
Heitor Augusto 590153d403 modules/output: expose withPerl 2024-11-13 15:21:17 -03:00
Matt Sturgeon c4ad4d0b2e modules/nixpkgs: add overlays option
Based on the `nixpkgs.overlays` option available in NixOS, allows users
to further customize the `pkgs` instance used when evaluating nixvim.

The standard module tests are now provided a few extra module args to
enable a test where we instantiate a custom nixpkgs instance.
2024-10-19 21:11:42 +01:00
Matt Sturgeon b9d17d5e6c modules/nixpkgs: restructure nixpkgs.pkgs.isDefined assertion
We can throw inline to ensure our error is displayed before any attempt
to use the (non-existent) `pkgs` arg results in a less helpful error.
2024-10-19 21:11:42 +01:00
Stanislav Asunkin 767eb62f48 modules/output: obtain plugin configs from wrapped neovim
The official method for obtaining the generated initRc content is from
wrapped neovim rather than from makeNeovimConfig helper. To use this
approach: first wrap neovim with the generated config, then override it
with our wrapperArgs.
2024-10-13 09:54:05 +03:00
Stanislav Asunkin ba77e88740 modules/output: remove unused binding 2024-10-13 09:33:20 +03:00
Matt Sturgeon 4b7a41276a modules/nixpkgs: initial pkgs option, drop defaultPkgs specialArg
This minimal implementation allows `nixpkgs.pkgs` to be defined, but
does not implement evaluating an instance from a pkgsPath when _not_
defined.

The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs`
being defined. If it's not defined, an assertion is thrown.

In the future, a nixpkgs source path can be supplied, defaulting to the
flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this
will allow a `pkgs` instance to be evaluated within the module eval.
2024-09-27 09:30:12 +01:00
Matt Sturgeon 8c3d521bff modules: move nixpkgs module to top-level modules
Make `pkgs` available to files submodules by passing _all_ module args
through. We already did this for `specialArgs`.
2024-09-27 09:30:12 +01:00
Matt Sturgeon 2f49c76a6a lib: remove nixvimTypes alias 2024-09-27 08:31:07 +01:00
Matt Sturgeon 6a1bf6bdc3 modules/output: check warnings+assertions on build.package
Add a `build.packageUnchecked` option for use instead of the old `check`
evalNixvim argument.
2024-09-26 18:04:36 +01:00
Matt Sturgeon 2ab8751b8b modules/output: add build.initSource option
Allows access to the init "source" file even when
`performance.byteCompileLua` is enabled.
2024-09-26 06:31:57 +01:00
Matt Sturgeon 692e39311e modules/{output,files,test}: move outputs to build scope
Move the following output options into `build`:
- finalPackage -> package
- printInitPackage
- initPath -> initFile
- filesPlugin -> extraFiles
- test.derivation -> test
2024-09-26 06:31:57 +01:00
Matt Sturgeon 7bda0f1ce4 modules/output: don't remove "site" dir when impureRtp is disabled
This is required for storing the state of several things, such as spell
files.
2024-09-25 18:43:32 +01:00
Matt Sturgeon 11924e1593 modules/output: add impureRtp option
Instead of assuming `wrapRc` implies we don't want impurities, configure
this separately.
2024-09-25 18:43:32 +01:00