Commit graph

292 commits

Author SHA1 Message Date
Austin Horstman
c3f9cb721c
lib/neovim-plugin: refactor mkLazyLoadOption 2024-12-10 10:07:38 -06:00
Austin Horstman
3cfde1554c
lib/neovim-plugin: support lz-n lazy config 2024-12-10 08:28:16 -06:00
Austin Horstman
da30527de1
lib/neovim-plugin: use mkLazyLoadOption 2024-12-10 08:28:16 -06:00
psfloyd
6ed719dba8
lib/options: added mkLazyLoadOption 2024-12-10 08:28:16 -06:00
Austin Horstman
301868d380
lib/neovim-plugin: support lazy loading luaConfig.content 2024-12-10 08:28:16 -06:00
Gaetan Lepage
cf7e026c8c mkNeovimPlugin: refactor lua code generation logic 2024-12-09 21:43:12 +00:00
Gaetan Lepage
ae78face8d
treewide: format with latest nixfmt 2024-12-06 15:25:27 +00:00
347Online | Katie Janzen
8507b01e0c lib/maintainers: add 347Online 2024-11-25 17:49:55 -06: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
587b1cbf21
lib/types: allow inline-lua in rawLua type 2024-11-16 17:20:11 +00:00
Matt Sturgeon
be455f7f27
lib/options: use literalLua for defaultNullOpts.mkRaw 2024-11-15 21:46:25 +00:00
Matt Sturgeon
da6e3499d4
lib/utils: add nestedLiteral and nestedLiteralLua
`nestedLiteral` converts a `literalExpression` into a `toPretty` style
pretty-printer.

`nestedLiteralLua` composes `nestedLiteral` and `literalLua` together.
2024-11-15 21:46:25 +00:00
Matt Sturgeon
eb76e62a9b
lib/utils: add literalLua for use in option docs
Creates a `literalExpression` equivalent to using `lib.nixvim.mkRaw`.
2024-11-15 21:46:25 +00:00
Matt Sturgeon
de99f2938f
lib/{vim,neovim}-plugin: installPackage -> packageDecorator
Replace `mkNeovimPlugin`'s `installPackage` parameter with a new
internal module option: `packageDecorator`.

The option is a function that applies some transformation to
`cfg.package`'s value before it is installed.
2024-11-15 21:44:59 +00:00
bpatel347
f8b3f16556 maintainers: add BoneyPatel 2024-11-15 07:27:48 +00:00
Gaetan Lepage
ccae4350d0 options: add defaultNullOpts.mkRaw 2024-11-13 23:38:31 +01:00
Matt Sturgeon
4e2a022165
lib/to-lua: fix allowUnkeyedAttrs option 2024-09-29 17:28:24 +01:00
Matt Sturgeon
bd6aa476b8
lib/options: remove redundant mkRaw apply functions
`strLua` now does this coercion internally.
2024-09-29 16:57:15 +01:00
Matt Sturgeon
a9c08fb6a5
lib/types: make strLua coerce strings to rawLua
Instead of relying on option `apply` functions to coerce the value to
rawLua, this can be done in the type's merge function.

Inspired by `types.coercedTo` in nixpkgs.
2024-09-29 16:57:15 +01:00
Matt Sturgeon
7886be8760
lib/types: flip maybeRaw's merge function
`maybeRaw` should prioritise merging `rawLua` before the other type
2024-09-29 16:57:15 +01:00
Matt Sturgeon
cd76b4feb8
lib: remove helpers from internal usage 2024-09-29 14:41:41 +01:00
wadsaek
c06d598315 maintainers: add wadsaek 2024-09-28 17:52:00 +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
Zain Kergaye
10925d811c maintainers: add ZainKergaye 2024-09-27 02:18:51 -06:00
Matt Sturgeon
2f49c76a6a
lib: remove nixvimTypes alias 2024-09-27 08:31:07 +01:00
Matt Sturgeon
d718446b61
lib: remove maintainers alias 2024-09-27 05:31:26 +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
Austin Horstman
3f17f500b3
lib/maintainers: remove duplicate entry 2024-09-26 10:45:23 -05: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
47364df496
lib/types/pluginLuaConfig: use lib.optional instead of lib.mkIf
This may slightly increase performance by reducing work done by the
module system.
2024-09-23 20:08:52 +01:00
Matt Sturgeon
81ae3febd2
lib: throw when deprecated builders are used on a lib without pkgs
Previously the deprecated builders would warn when used on a lib _with_
`pkgs`, but were simply not present on a lib _without_ `pkgs`.

Now, they are always present, but will throw when evaluated on a lib
_without_ `pkgs`.
2024-09-22 18:18:05 +01:00
Matt Sturgeon
191b0a9502
treewide: avoid passing pkgs to our lib
In the two places where our "helpers" lib is exclusively internal
(flake module args and building the docs), we no longer supply `pkgs`.

In the other 4 locations, we now note why we still do in a comment.
2024-09-22 18:18:05 +01:00
Matt Sturgeon
76df09619d
lib/types/pluginLuaConfig: only merge pre and post when defined
- Have them default to `null`
- Only merge them into `content` when non-null
- Mention this in `content`'s description
2024-09-22 17:49:41 +01:00
Quentin Boyer
d2f9e011d9 lib/neovim-plugin: Add lua configuration scoped to the plugin
This commit adds a `plugins.<name>.luaConfig` section controlling the
plugin specific configuration.

The section contains the internal `init` option, containing the plugin's
initialization code.

It also contains the public `pre` and `post` options, that allow to add
code before & after the `init` section

Finally, it contains the `final` option, being the concatenation of the
three previous options.
2024-09-22 16:15:27 +00:00
Jeremy Fleischman
400d1d927d
lib: fix escaping bugs in wrapVimscriptForLua and wrapLuaForVimscript
These functions had very similar bugs: they didn't check if their chosen
"close token" was already present in the string they're escaping.

I went ahead and did the work implied by the TODOs: search for a "close
token" that is *not* in the original string. Pretty simple concept, but
it turned into an annoying amount of code. I couldn't find anything in
upstream nixpkgs lib, or some clever insight about lua/vimscript that
makes this work unecessary, but I'll be thrilled (and a little bummed
about a wasted afternoon) to learn about something.
2024-09-19 15:41:46 -07: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
f47e8f8f79
lib: use lib.fix and self internally 2024-09-13 17:25:17 +01:00
Matt Sturgeon
7a147234f8
lib: rename helpers.nix -> default.nix
The old `default.nix` is inlined into the "lib" flake-module, which is
the only place it was used.

This allows "helpers" to take its rightful place at the root of `./lib` 👑
2024-09-13 17:25:17 +01:00
Matt Sturgeon
27a0dd435d
lib/types: simplify eitherRecursive by defining it only once 2024-09-12 14:44:54 +01:00
Matt Sturgeon
555035ef79
lib: add types.flagInt + defaultNullOpts.mkIntFlag
Either `0` or `1`, but can be coerced from a boolean definition to
support legacy definitions.

When coerced, a warning is printed
2024-09-08 12:54:30 +01:00
Matt Sturgeon
fd923a3dd3
lib/options: remove deprecated package option helpers
`mkPackageOption` and `mkPluginPackageOption` have both been replaced
with nixpkg's `lib.mkPackageOption`.
2024-09-05 02:24:52 +01:00
Matt Sturgeon
cdb2e79e51
lib/pkg-lists: move to common location
Extract the helper functions defined in `efmls-configs-pkgs` to a common
location where they can also be used by none-ls's package list.
2024-09-04 20:29:52 +01:00
Austin Horstman
35788bbc5a
lib: cleanup with lib 2024-09-03 22:12:33 -05:00
Matt Sturgeon
1fd4b6c739
plugins: migrate defaultPackage -> package
Migrate all users of `mkVimPlugin` and `mkNeovimPlugin` to use the new
`package` argument instead of the old `defaultPackage` argument.
2024-09-04 03:29:34 +01:00
Matt Sturgeon
285f6cbd7b
lib/*-plugin: use lib.mkPackageOption internally
Instead of maintainers providing an actual `defaultPackage`, they should
specify the pkg name which we'll use when calling `lib.mkPackageOption`.

This makes `mkVimPlugin` and `mkNeovimPlugin` compliant with #1950.
2024-09-04 03:07:49 +01:00
Matt Sturgeon
18b7597e6c
lib/neovim-plugin: drop config arg 2024-09-02 10:35:52 +01:00
Matt Sturgeon
2a054b039e
lib/vim-plugin: drop config arg
Instead, access it via an imported module
2024-09-02 10:33:50 +01:00
Andrew Plaza
204f1aecf2
maintainers: add insipx 2024-09-02 02:05:40 -04:00