From 12ed05bcfbbe013089dbc3fc18cb293f224fbd06 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 28 Oct 2024 02:26:56 +0100 Subject: [PATCH] lazy: refactor common var --- modules/wrapper/lazy/config.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix index da5dd8c..a76a5cd 100644 --- a/modules/wrapper/lazy/config.nix +++ b/modules/wrapper/lazy/config.nix @@ -58,6 +58,8 @@ }; lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins; + pluginPackages = mapAttrsToList (_: plugin: plugin.package) cfg.plugins; + specToNotLazyConfig = _: spec: '' do ${optionalString (spec.before != null) spec.before} @@ -80,7 +82,7 @@ in { (mkIf cfg.enable { startPlugins = ["lz-n" "lzn-auto-require"]; - optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins; + optPlugins = pluginPackages; luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] '' require('lz.n').load(${toLuaObject lznSpecs}) @@ -88,7 +90,7 @@ in { }) (mkIf (!cfg.enable) { - startPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins; + startPlugins = pluginPackages; luaConfigPre = concatStringsSep "\n" (filter (x: x != null) (mapAttrsToList (_: spec: spec.beforeAll) cfg.plugins));