some cleanup

This commit is contained in:
Dmitriy Pleshevskiy 2023-05-23 00:19:13 +03:00
parent 54333ac0a6
commit 3717b5002d
Signed by: pleshevskiy
GPG Key ID: 79C4487B44403985
3 changed files with 9 additions and 11 deletions

View File

@ -204,7 +204,7 @@
patches = lib.optional patches = lib.optional
(pathExists ./patches/${name}) (pathExists ./patches/${name})
(map (map
(fn: ./patches/${name}/${fn}) (patchName: ./patches/${name}/${patchName})
(attrNames (readDir ./patches/${name})) (attrNames (readDir ./patches/${name}))
); );
}; };

View File

@ -9,34 +9,31 @@
, theme ? { } , theme ? { }
, plugins ? { } , plugins ? { }
, wrapNeovim , wrapNeovim
, runCommand
, neovim-unwrapped , neovim-unwrapped
, tree-sitter , tree-sitter
, neovimPlugins , neovimPlugins
, lib , lib
, nix2lua , nix2lua
, substituteAll , substituteAll
, fetchFromGitHub , callPackage
, fetchFromGitea
, ... , ...
}: }:
let let
inherit (builtins) catAttrs isFunction readFile; inherit (builtins) catAttrs readFile;
myLib = import ./lib.nix { inherit lib; } // { myLib = import ./lib.nix { inherit lib; } // {
inherit substituteAll; inherit substituteAll;
inherit (nix2lua.lib) toLua mkLuaNil; inherit (nix2lua.lib) toLua mkLuaNil;
}; };
pluginParams = neovimPlugins // { pluginParams = neovimPlugins // {
inherit runCommand tree-sitter fetchFromGitHub fetchFromGitea; inherit tree-sitter plugins enableDevIcons enableTabby enableOrgMode;
inherit plugins enableDevIcons enableTabby enableOrgMode;
themeCfg = theme; themeCfg = theme;
lib = myLib; lib = myLib;
}; };
callPlugin = op: callPlugin = plugin: callPackage plugin pluginParams;
if isFunction op then op pluginParams else import op pluginParams;
callPlugins = list: map callPlugin list; callPlugins = list: map callPlugin list;
pluginsSettings = callPlugins [ pluginsSettings = callPlugins [

View File

@ -13,8 +13,9 @@ let
hopLuaConfig = readFile ./hop-nvim.lua; hopLuaConfig = readFile ./hop-nvim.lua;
orgmodeEnable = lib.attrByPath [ "orgmode" "enable" ] enableOrgMode plugins;
orgmodeSettings = lib.toLua (lib.attrByPath [ "orgmode" "settings" ] { } plugins); orgmodeSettings = lib.toLua (lib.attrByPath [ "orgmode" "settings" ] { } plugins);
orgmodeLuaConfig = lib.optional enableOrgMode (readFile (lib.substituteAll { src = ./nvim-orgmode.lua; inherit orgmodeSettings; })); orgmodeLuaConfig = lib.optional orgmodeEnable (readFile (lib.substituteAll { src = ./nvim-orgmode.lua; inherit orgmodeSettings; }));
colorizerFiletypes = lib.toLua (lib.attrByPath [ "colorizer" "filetypes" ] lib.mkLuaNil plugins); colorizerFiletypes = lib.toLua (lib.attrByPath [ "colorizer" "filetypes" ] lib.mkLuaNil plugins);
colorizerSettings = lib.toLua (lib.attrByPath [ "colorizer" "settings" ] lib.mkLuaNil plugins); colorizerSettings = lib.toLua (lib.attrByPath [ "colorizer" "settings" ] lib.mkLuaNil plugins);
@ -24,5 +25,5 @@ in
luaConfig = hopLuaConfig + orgmodeLuaConfig + colorizerLuaConfig; luaConfig = hopLuaConfig + orgmodeLuaConfig + colorizerLuaConfig;
plugins = [ hop-nvim nvim-colorizer ] plugins = [ hop-nvim nvim-colorizer ]
++ lib.optional enableOrgMode [ nvim-orgmode org-bullets-nvim ]; ++ lib.optional orgmodeEnable [ nvim-orgmode org-bullets-nvim ];
} }