lib/plugins: call sub-components with relevant args

This commit is contained in:
Matt Sturgeon 2024-12-18 23:15:09 +00:00
parent 690fc895b5
commit 787844cfe4
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
4 changed files with 21 additions and 23 deletions

View file

@ -1,13 +1,14 @@
{ { lib }:
call, let
lib, self = lib.nixvim.plugins;
}: call = lib.callPackageWith (self // { inherit call lib self; });
in
{ {
utils = call ./utils.nix { }; utils = call ./utils.nix { };
neovim = call ./neovim.nix { }; neovim = call ./neovim.nix { };
vim = call ./vim.nix { }; vim = call ./vim.nix { };
# Aliases # Aliases
inherit (lib.nixvim.plugins.neovim) mkNeovimPlugin; inherit (self.neovim) mkNeovimPlugin;
inherit (lib.nixvim.plugins.vim) mkVimPlugin; inherit (self.vim) mkVimPlugin;
} }

View file

@ -1,4 +1,7 @@
{ lib }: {
lib,
utils,
}:
{ {
name, name,
maintainers, maintainers,
@ -56,7 +59,7 @@ let
}) })
''; '';
luaConfigAtLocation = lib.nixvim.plugins.utils.mkConfigAt configLocation cfg.luaConfig.content; luaConfigAtLocation = utils.mkConfigAt configLocation cfg.luaConfig.content;
in in
{ {
meta = { meta = {
@ -105,7 +108,7 @@ let
# Apply any additional configuration added to `extraConfig` # Apply any additional configuration added to `extraConfig`
(lib.optionalAttrs (args ? extraConfig) ( (lib.optionalAttrs (args ? extraConfig) (
lib.nixvim.plugins.utils.applyExtraConfig { utils.applyExtraConfig {
inherit extraConfig cfg opts; inherit extraConfig cfg opts;
} }
)) ))
@ -162,7 +165,7 @@ in
imports imports
++ [ ++ [
module module
(lib.nixvim.plugins.utils.mkPluginPackageModule { inherit loc packPathName package; }) (utils.mkPluginPackageModule { inherit loc packPathName package; })
] ]
++ lib.optional deprecateExtraOptions ( ++ lib.optional deprecateExtraOptions (
lib.mkRenamedOptionModule (loc ++ [ "extraOptions" ]) settingsPath lib.mkRenamedOptionModule (loc ++ [ "extraOptions" ]) settingsPath

View file

@ -1,9 +1,7 @@
{ lib }: {
let lib,
inherit (lib.nixvim.plugins.vim) self,
mkSettingsOption }:
;
in
{ {
name, name,
url ? throw "default", url ? throw "default",
@ -43,7 +41,7 @@ let
createSettingsOption = lib.isString globalPrefix && globalPrefix != ""; createSettingsOption = lib.isString globalPrefix && globalPrefix != "";
settingsOption = lib.optionalAttrs createSettingsOption { settingsOption = lib.optionalAttrs createSettingsOption {
settings = mkSettingsOption { settings = self.vim.mkSettingsOption {
options = settingsOptions; options = settingsOptions;
example = settingsExample; example = settingsExample;
inherit name globalPrefix; inherit name globalPrefix;

View file

@ -1,12 +1,8 @@
{ {
call, call,
lib, lib,
self,
}: }:
let
inherit (lib.nixvim.plugins.vim)
mkSettingsOptionDescription
;
in
{ {
mkVimPlugin = call ./mk-vim-plugin.nix { }; mkVimPlugin = call ./mk-vim-plugin.nix { };
@ -31,6 +27,6 @@ in
}: }:
lib.nixvim.mkSettingsOption { lib.nixvim.mkSettingsOption {
inherit options example; inherit options example;
description = mkSettingsOptionDescription { inherit name globalPrefix; }; description = self.vim.mkSettingsOptionDescription { inherit name globalPrefix; };
}; };
} }