lib/neovim-plugin: allow configLocation to be wrapped using mkOrder

This commit is contained in:
Matt Sturgeon 2024-12-14 01:26:45 +00:00
parent c181014422
commit 6a192a8604
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
4 changed files with 41 additions and 4 deletions

View file

@ -71,7 +71,7 @@
})
'';
setLuaConfig = lib.setAttrByPath (lib.toList configLocation);
luaConfigAtLocation = lib.nixvim.modules.mkConfigAt configLocation cfg.luaConfig.content;
in
{
meta = {
@ -162,8 +162,8 @@
# Add the plugin setup code `require('foo').setup(...)` to the lua configuration
(lib.optionalAttrs callSetup { ${namespace}.${name}.luaConfig.content = setupCode; })
# Write the lua configuration `luaConfig.content` to the config file when lazy loading is not enabled
(lib.mkIf (!cfg.lazyLoad.enable) (setLuaConfig cfg.luaConfig.content))
# When NOT lazy loading, write `luaConfig.content` to `configLocation`
(lib.mkIf (!cfg.lazyLoad.enable) luaConfigAtLocation)
# When lazy loading is enabled for this plugin, route its configuration to the enabled provider
(lib.mkIf cfg.lazyLoad.enable {