Commit graph

21 commits

Author SHA1 Message Date
Matt Sturgeon
0c7e2aa96b
docs: user-guide/helpers.mdlib/index.md
Move the user-guide to the new lib reference docs.

Added a MDBook redirect entry.

Updated man docs.
2025-05-19 00:19:57 +01:00
Matt Sturgeon
53bfadc2c2
lib/modules: work-around a submodule type-merging issue
Includes a regression test.

Revert "lib/modules: remove explicit `specialArgs.lib`"

This reverts commit b5efe91c52.
2025-01-21 12:10:29 +00:00
Matt Sturgeon
8c6f9ed8c4
lib/modules: allow specifying system as an evalNixvim arg 2025-01-17 10:16:10 +00:00
Matt Sturgeon
c19daee453
docs/user-guide: document nixvim's lib overlay 2025-01-17 02:23:10 +00:00
Matt Sturgeon
16662760a9
lib/modules: specify modulesPath
`specialArgs.modulesPath` can be used to allow users to manually
import modules relative to our `./modules` directory.

It is also used by the module system to provide a base path for
relative `disabledModules` paths.
2025-01-17 00:28:36 +00:00
Matt Sturgeon
b5efe91c52
lib/modules: remove explicit specialArgs.lib
`lib.evalModules` will do this internally anyway
2025-01-17 00:21:28 +00:00
Matt Sturgeon
9487403532
modules/context: flake option, provides access to our flake 2024-12-23 12:18:06 +00:00
Matt Sturgeon
6f45ca4a22
lib/modules: flake is now required 2024-12-23 11:55:32 +00:00
Matt Sturgeon
403d5e23c5
lib/modules: remove assertion message for removed check arg 2024-12-23 11:54:35 +00:00
Matt Sturgeon
896f6be694
lib/plugins: take ownership of modules utils
These util functions were previously defined in `modules`, but
`plugins.utils` is a better home.
2024-12-22 09:35:16 +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
Matt Sturgeon
6a192a8604
lib/neovim-plugin: allow configLocation to be wrapped using mkOrder 2024-12-14 02:39:44 +00:00
Matt Sturgeon
63cfc84abe
lib/modules: add applyExtraConfig
Used for
- mkVimPlugin: extraConfig
- mkNeovimPlugin: extraConfig
- mkLsp: extraConfig
- mkLsp: settings
- mkExtension (telecsope): extraConfig
2024-11-20 20:55:16 +00:00
Matt Sturgeon
6b0c5d594a
lib/modules: assert that specialArgs has a valid lib
End-users have ran into issues before when attempting to re-use a `lib`
from elsewhere in nixvim's configuration.

If a `lib` without the `nixvim` extension is used, this assertion will
inform the user that this isn't supported.

In the future we can also provide better ways for end-users to overlay
their own lib with nixvim's extensions, but this is not yet implemented.

Co-authored-by: Gaétan Lepage <33058747+GaetanLepage@users.noreply.github.com>
2024-09-27 11:11:49 +01:00
Matt Sturgeon
5020e58798
lib/modules: remove specialArgsWith 2024-09-27 09:30:12 +01: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
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
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
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
851edc8df1
lib/modules: add evalNixvim
Evaluates a nixvim config, by default also checking warnings and assertions.

This used internally by the standalone wrapper.
2024-08-20 22:22:53 +01:00
Matt Sturgeon
27c4c9c210
lib/modules: init with specialArgs helpers 2024-08-02 14:38:38 +01:00