mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
lazy: refactor common var
This commit is contained in:
parent
aac776f7a4
commit
12ed05bcfb
1 changed files with 4 additions and 2 deletions
|
@ -58,6 +58,8 @@
|
||||||
};
|
};
|
||||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||||
|
|
||||||
|
pluginPackages = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||||
|
|
||||||
specToNotLazyConfig = _: spec: ''
|
specToNotLazyConfig = _: spec: ''
|
||||||
do
|
do
|
||||||
${optionalString (spec.before != null) spec.before}
|
${optionalString (spec.before != null) spec.before}
|
||||||
|
@ -80,7 +82,7 @@ in {
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
optPlugins = pluginPackages;
|
||||||
|
|
||||||
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
||||||
require('lz.n').load(${toLuaObject lznSpecs})
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
|
@ -88,7 +90,7 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (!cfg.enable) {
|
(mkIf (!cfg.enable) {
|
||||||
startPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
startPlugins = pluginPackages;
|
||||||
luaConfigPre =
|
luaConfigPre =
|
||||||
concatStringsSep "\n"
|
concatStringsSep "\n"
|
||||||
(filter (x: x != null) (mapAttrsToList (_: spec: spec.beforeAll) cfg.plugins));
|
(filter (x: x != null) (mapAttrsToList (_: spec: spec.beforeAll) cfg.plugins));
|
||||||
|
|
Loading…
Reference in a new issue