mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib/vim-plugin: drop config
arg
Instead, access it via an imported module
This commit is contained in:
parent
9b0e2ba7e5
commit
2a054b039e
45 changed files with 67 additions and 102 deletions
|
@ -2,7 +2,6 @@
|
|||
with lib;
|
||||
{
|
||||
mkVimPlugin =
|
||||
config:
|
||||
{
|
||||
name,
|
||||
url ? if defaultPackage != null then defaultPackage.meta.homepage else null,
|
||||
|
@ -30,10 +29,6 @@ with lib;
|
|||
let
|
||||
namespace = if isColorscheme then "colorschemes" else "plugins";
|
||||
|
||||
cfg = config.${namespace}.${name};
|
||||
|
||||
globals = cfg.settings or { };
|
||||
|
||||
# does this evaluate package?
|
||||
packageOption =
|
||||
if defaultPackage == null then
|
||||
|
@ -58,6 +53,27 @@ with lib;
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
modules = [
|
||||
(
|
||||
{ config, ... }:
|
||||
let
|
||||
cfg = config.${namespace}.${name};
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
inherit extraPackages;
|
||||
globals = mapAttrs' (n: nameValuePair (globalPrefix + n)) (cfg.settings or { });
|
||||
# does this evaluate package? it would not be desired to evaluate package if we use another package.
|
||||
extraPlugins = extraPlugins ++ optional (defaultPackage != null) cfg.package;
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { colorscheme = mkDefault colorscheme; })
|
||||
(extraConfig cfg)
|
||||
]);
|
||||
}
|
||||
)
|
||||
];
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
|
@ -86,17 +102,8 @@ with lib;
|
|||
++ (optional (deprecateExtraConfig && createSettingsOption) (
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extraConfig" ]) settingsPath
|
||||
))
|
||||
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings);
|
||||
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings)
|
||||
++ modules;
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
inherit extraPackages;
|
||||
globals = mapAttrs' (n: nameValuePair (globalPrefix + n)) globals;
|
||||
# does this evaluate package? it would not be desired to evaluate package if we use another package.
|
||||
extraPlugins = extraPlugins ++ optional (defaultPackage != null) cfg.package;
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { colorscheme = mkDefault colorscheme; })
|
||||
(extraConfig cfg)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue