lib: provide an "extended lib" to our modules

lib/extend-lib.nix returns a nixpkg's lib extended with our own
helpers.

This is exposed as `helpers.extendedLib`, but when evaluating our
modules it should be assigned to `specialArgs.lib`.

Outside of our modules you must still access our helpers via
`config.lib.nixvim` or `config.lib.nixvim.extendedLib`.

Within helpers' sub-sections, `lib` is the extended lib.
This commit is contained in:
Matt Sturgeon 2024-08-01 18:26:38 +01:00
parent 7c39d77b9f
commit 491ca5cf51
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
7 changed files with 49 additions and 2 deletions

View file

@ -6,16 +6,20 @@
}:
let
# Used when importing parts of helpers
call = lib.callPackageWith { inherit pkgs lib helpers; };
call = lib.callPackageWith {
# TODO: deprecate/remove using `helpers` in the subsections
inherit pkgs helpers;
lib = helpers.extendedLib;
};
# Build helpers recursively
helpers = {
autocmd = call ./autocmd-helpers.nix { };
builders = call ./builders.nix { };
deprecation = call ./deprecation.nix { };
extendedLib = call ./extend-lib.nix { inherit lib; };
keymaps = call ./keymap-helpers.nix { };
lua = call ./to-lua.nix { };
maintainers = import ./maintainers.nix;
neovim-plugin = call ./neovim-plugin.nix { };
nixvimTypes = call ./types.nix { };
options = call ./options.nix { };
@ -78,6 +82,9 @@ let
wrapVimscriptForLua
;
# TODO: Deprecate this `maintainers` alias
inherit (helpers.extendedLib) maintainers;
toLuaObject = helpers.lua.toLua;
};
in