lib/helpers: call with auto-args

Define `call = callPackageWith { inherit pkgs lib helpers; }`, which can
be used to automatically pass the correct args into helpers files.

`helpers` is passed in recursively.
This commit is contained in:
Matt Sturgeon 2024-07-28 22:51:18 +01:00
parent 0e98d9cf1e
commit 040bab5f55
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 15 additions and 12 deletions

View file

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib }:
with lib;
rec {
# Get a (sub)option by walking the path,

View file

@ -5,21 +5,24 @@
...
}:
let
# Used when importing parts of helpers
call = lib.callPackageWith { inherit pkgs lib helpers; };
# Build helpers recursively
helpers =
{
autocmd = import ./autocmd-helpers.nix { inherit lib helpers; };
keymaps = import ./keymap-helpers.nix { inherit lib helpers; };
lua = import ./to-lua.nix { inherit lib; };
autocmd = call ./autocmd-helpers.nix { };
keymaps = call ./keymap-helpers.nix { };
lua = call ./to-lua.nix { };
toLuaObject = helpers.lua.toLua;
maintainers = import ./maintainers.nix;
neovim-plugin = import ./neovim-plugin.nix { inherit lib helpers; };
nixvimTypes = import ./types.nix { inherit lib helpers; };
vim-plugin = import ./vim-plugin.nix { inherit lib helpers; };
neovim-plugin = call ./neovim-plugin.nix { };
nixvimTypes = call ./types.nix { };
vim-plugin = call ./vim-plugin.nix { };
}
// import ./builders.nix { inherit lib pkgs; }
// import ./deprecation.nix { inherit lib; }
// import ./options.nix { inherit lib helpers; }
// import ./utils.nix { inherit lib helpers _nixvimTests; };
// call ./builders.nix { }
// call ./deprecation.nix { }
// call ./options.nix { }
// call ./utils.nix { inherit _nixvimTests; };
in
helpers

View file

@ -1,4 +1,4 @@
{ lib, helpers, ... }:
{ lib, helpers }:
with lib;
with helpers;
with lib.types;