Commit graph

77 commits

Author SHA1 Message Date
Stanislav Asunkin
f28d384ab5 modules/performance/combine-plugins: propagate lua dependencies
Plugins from luarocks (e.g. telescope-nvim) have dependencies specified
in propagatedBuildInputs. These dependencies are not added as plugins in
Nvim runtime. They are added to LUA_PATH env var for wrapped neovim.
This commit collects all propagatedBuildInputs from input plugin list
and puts them in the combined plugin.
Note that such dependencies are never combined, because they are not
plugins.
2025-04-28 17:26:13 +03: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
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
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
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
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
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
c4a54da4a5
modules/output: use mkPackageOption for package option 2024-09-04 21:56:48 +01: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
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
Matt Sturgeon
6975ee09f5
modules/outputs: make type readOnly at the top-level
Instead of relying on `lib.mkForce` we can enforce this more strictly by
setting the option "readOnly".
2024-08-20 22:02:29 +01:00