From ed69816f68414a91104f7abe9a77a9e1b5630467 Mon Sep 17 00:00:00 2001 From: diniamo Date: Fri, 20 Dec 2024 10:43:36 +0100 Subject: [PATCH] wrapper/lazy: add beforeSetup option Useful for avoiding a million require calls in setupOpts. --- modules/wrapper/lazy/config.nix | 1 + modules/wrapper/lazy/lazy.nix | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix index 6a9a6ea..3468d5e 100644 --- a/modules/wrapper/lazy/config.nix +++ b/modules/wrapper/lazy/config.nix @@ -76,6 +76,7 @@ else mkLuaInline '' function() + ${optionalString (spec.beforeSetup != null) spec.beforeSetup} ${ optionalString (spec.setupModule != null) "require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})" diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix index e0dbea8..730bf26 100644 --- a/modules/wrapper/lazy/lazy.nix +++ b/modules/wrapper/lazy/lazy.nix @@ -74,6 +74,15 @@ ''; }; + beforeSetup = mkOption { + type = nullOr lines; + default = null; + description = '' + Lua code to run after the plugin is loaded, but before the setup + function is called. + ''; + }; + setupModule = mkOption { type = nullOr str; default = null;