Commit Graph
168 Commits
Author SHA1 Message Date
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äckelandnix-infra-bot 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 Fleischmanandnix-infra-bot 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 Lepageandnix-infra-bot 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 Augustoandnix-infra-bot 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
Matt Sturgeon fb7cda2868 modules/output: refactor wrapRc default
Set default to `true`, with a low priority. Home-manager's wrapper sets
its own default using `mkOptionDefault`.

Clarify using `defaultText`.
2024-09-25 18:43:10 +01:00
Matt Sturgeon b3a90d737d modules/files: don't set shorthandOnlyDefinesConfig 2024-09-24 19:17:44 +01:00
Matt Sturgeon 6da94195c2 modules/misc: include assertions and meta modules in the repo
Based on the modules we previously imported from NixOS.

This will allow us to drop the `defaultPkgs` specialArg and avoids
needing the proposed `pkgsPath` specialArg.
2024-09-24 12:49:28 +01:00
Matt Sturgeon 4e5bd1d79b lib: segregate and deprecate functions that need pkgs
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.
2024-09-13 19:05:26 +01:00
Matt Sturgeon 48e9af500c plugins/by-name: remove pathExists check 2024-09-09 11:50:41 +01:00
Matt Sturgeon faff32b9f1 plugins/by-name: init
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.
2024-09-09 11:50:38 +01:00
Matt Sturgeon c4a54da4a5 modules/output: use mkPackageOption for package option 2024-09-04 21:56:48 +01:00
Austin Horstman 1c9ba58aef modules: cleanup with lib 2024-09-03 22:12:33 -05:00
Matt Sturgeon 4814147442 modules/test: add config and options passthrus
This should make inspection of tests a little easier.
2024-08-28 00:08:10 +01:00
Matt Sturgeon af31063538 modules/test: switch to runCommand 2024-08-28 00:08:10 +01:00
Austin Horstman 8a272143ee modules/opts: move options to top of init.lua
Using mkOrder to ensure the options can be accessible to everything
throughout the config. Setting right below global table available, so
variables can reference stuff inside global table.
2024-08-24 11:50:06 -05:00
Austin Horstman 203d31810f top-level/output: add global table top of init.lua
Creating a global table at top of init.lua to allow sharing between
different sections of the init.lua without worrying about ordering.
2024-08-24 11:33:08 -05:00
Matt Sturgeon 088e584e54 modules/test: check warnings/assertions
Warnings and assertions defined as `config.warnings` and `config.assertions`
respectively will be checked as part of the test derivation, instead of
when evaluating the modules.

Adds new `checkWarnings` and `checkAssertions` test options (default true).
2024-08-22 14:46:55 +01:00
Matt Sturgeon 38b09c1621 modules/test: remove docker dependency 2024-08-21 02:48:26 +01:00
Matt Sturgeon cbd1003d9d modules/test: move test derivation to an option
Introduced the `test.derivation` read-only option.
2024-08-21 02:48:00 +01:00
Matt Sturgeon bc7a7ad1d6 module/outputs: use mkIf for wrapRc
Implement the `wrapRc` option using `lib.mkIf` instead of using _real_
`if` branches.
2024-08-20 22:02:29 +01:00