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; with lib;
rec { rec {
# Get a (sub)option by walking the path, # Get a (sub)option by walking the path,

View file

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

View file

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