Add a non-system specific `<flake>.lib.nixvim` output, which is
equivalent to the existing `<flake>.lib.<system>.helpers` output.
This is now also wrapped with `lib.makeOverridable` to allow overriding
the function args used to construct the nixvim-lib.
Consistently access nixvim-lib via the new flake output, overriding
where necessary.
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.
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.
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.
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` 👑
Make our "extended" lib available to host modules as `_module.args.nixvimLib`.
We didn't do this before because `helpers` was too generic of a name,
but `nixvimLib` should be ok.
{ nixvimLib, ... }: {
programs.nixvim.someOption = nixvimLib.nixvim.mkRaw "print('Hi')";
}
This commit adds support for byte compiling lua configuration files.
It's enabled by default (if byte compiling is enabled at all) and can be
disabled with `performance.byteCompileLua.configs` toggle.
To implement this feature `extraFiles.<name>.finalSource` internal
read-only option is introduced. `source` option cannot be used because
it's user configurable. In order to access the values of the
`performance.byteCompileLua` options, parent config is added to
specialArgs of extraFiles submodule. Then the usages of `source` option
changed to `finalSource` in all relevant places (filesPlugin and
wrappers).
Added more helpers for various cases of byte compiling:
* `byteCompileLuaFile` byte compiles lua file
* `byteCompileLuaHook` is a setup hook that byte compiles all lua files
* `byteCompileLuaDrv` overrides derivation by adding byteCompileLuaHook
to it
Added tests to validate that extraFiles specified by various methods are
handled correctly. Added a separate home-manager test, that is intended
to validate that extraFiles propagated to wrapper modules are correctly
byte compiled.
NixOS, HM, & Darwin provide a `lib` option, not to be confused with the
`lib` module arg.
This option is intended for modules to define custom functions without
having to extend nixpkgs lib.
The old option is renamed, if it is accessed it will print:
trace: Obsolete option `nixvim.helpers' is used. It was renamed to `lib.nixvim'.
Moved `extraFiles` from `modules/output.nix` into its own file `modules/files.nix`.
Users should now assign text to a `text` attribute, however they could
also assign a file path to a `source` attribute instead.
The old method of directly assigning a string still works, and is
coerced to the new type along with a deprecation warning.
Let's simplify things by defining all modules in `./plugins`, `./modules`
and `./wrappers/modules`.
Instead of currying `pkgs` into a bootstrapping module, we can require
`defaultPkgs` be provided as a special arg.
This refactor allows us to completely remove `flake-modules/modules.nix`!
To enable some features (like adding tree-sitter queries) we need to add
files to specific directories in the runtime path (queries/lang/file.scm
for tree-sitter queries for example).
This commit adds support for specifying such files. You must be careful
to not have any collisions between `files` and `extraFiles`.