From 787844cfe496577db468adbfcaa5dd2f7dd2032d Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 18 Dec 2024 23:15:09 +0000 Subject: [PATCH] lib/plugins: call sub-components with relevant args --- lib/plugins/default.nix | 13 +++++++------ lib/plugins/mk-neovim-plugin.nix | 11 +++++++---- lib/plugins/mk-vim-plugin.nix | 12 +++++------- lib/plugins/vim.nix | 8 ++------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/plugins/default.nix b/lib/plugins/default.nix index 341d4a16e..562e61e67 100644 --- a/lib/plugins/default.nix +++ b/lib/plugins/default.nix @@ -1,13 +1,14 @@ -{ - call, - lib, -}: +{ lib }: +let + self = lib.nixvim.plugins; + call = lib.callPackageWith (self // { inherit call lib self; }); +in { utils = call ./utils.nix { }; neovim = call ./neovim.nix { }; vim = call ./vim.nix { }; # Aliases - inherit (lib.nixvim.plugins.neovim) mkNeovimPlugin; - inherit (lib.nixvim.plugins.vim) mkVimPlugin; + inherit (self.neovim) mkNeovimPlugin; + inherit (self.vim) mkVimPlugin; } diff --git a/lib/plugins/mk-neovim-plugin.nix b/lib/plugins/mk-neovim-plugin.nix index 4bf51eac7..d7cbb1198 100644 --- a/lib/plugins/mk-neovim-plugin.nix +++ b/lib/plugins/mk-neovim-plugin.nix @@ -1,4 +1,7 @@ -{ lib }: +{ + lib, + utils, +}: { name, maintainers, @@ -56,7 +59,7 @@ let }) ''; - luaConfigAtLocation = lib.nixvim.plugins.utils.mkConfigAt configLocation cfg.luaConfig.content; + luaConfigAtLocation = utils.mkConfigAt configLocation cfg.luaConfig.content; in { meta = { @@ -105,7 +108,7 @@ let # Apply any additional configuration added to `extraConfig` (lib.optionalAttrs (args ? extraConfig) ( - lib.nixvim.plugins.utils.applyExtraConfig { + utils.applyExtraConfig { inherit extraConfig cfg opts; } )) @@ -162,7 +165,7 @@ in imports ++ [ module - (lib.nixvim.plugins.utils.mkPluginPackageModule { inherit loc packPathName package; }) + (utils.mkPluginPackageModule { inherit loc packPathName package; }) ] ++ lib.optional deprecateExtraOptions ( lib.mkRenamedOptionModule (loc ++ [ "extraOptions" ]) settingsPath diff --git a/lib/plugins/mk-vim-plugin.nix b/lib/plugins/mk-vim-plugin.nix index 48e0ff10a..daa571f16 100644 --- a/lib/plugins/mk-vim-plugin.nix +++ b/lib/plugins/mk-vim-plugin.nix @@ -1,9 +1,7 @@ -{ lib }: -let - inherit (lib.nixvim.plugins.vim) - mkSettingsOption - ; -in +{ + lib, + self, +}: { name, url ? throw "default", @@ -43,7 +41,7 @@ let createSettingsOption = lib.isString globalPrefix && globalPrefix != ""; settingsOption = lib.optionalAttrs createSettingsOption { - settings = mkSettingsOption { + settings = self.vim.mkSettingsOption { options = settingsOptions; example = settingsExample; inherit name globalPrefix; diff --git a/lib/plugins/vim.nix b/lib/plugins/vim.nix index f1bcb2cbc..c1ea41620 100644 --- a/lib/plugins/vim.nix +++ b/lib/plugins/vim.nix @@ -1,12 +1,8 @@ { call, lib, + self, }: -let - inherit (lib.nixvim.plugins.vim) - mkSettingsOptionDescription - ; -in { mkVimPlugin = call ./mk-vim-plugin.nix { }; @@ -31,6 +27,6 @@ in }: lib.nixvim.mkSettingsOption { inherit options example; - description = mkSettingsOptionDescription { inherit name globalPrefix; }; + description = self.vim.mkSettingsOptionDescription { inherit name globalPrefix; }; }; }