diff --git a/flake.nix b/flake.nix index 87d0fd1..0155ad7 100644 --- a/flake.nix +++ b/flake.nix @@ -204,7 +204,7 @@ patches = lib.optional (pathExists ./patches/${name}) (map - (fn: ./patches/${name}/${fn}) + (patchName: ./patches/${name}/${patchName}) (attrNames (readDir ./patches/${name})) ); }; diff --git a/neovim.nix b/neovim.nix index fbc66e5..b9705f5 100644 --- a/neovim.nix +++ b/neovim.nix @@ -9,34 +9,31 @@ , theme ? { } , plugins ? { } , wrapNeovim -, runCommand , neovim-unwrapped , tree-sitter , neovimPlugins , lib , nix2lua , substituteAll -, fetchFromGitHub -, fetchFromGitea +, callPackage , ... }: let - inherit (builtins) catAttrs isFunction readFile; + inherit (builtins) catAttrs readFile; + myLib = import ./lib.nix { inherit lib; } // { inherit substituteAll; inherit (nix2lua.lib) toLua mkLuaNil; }; pluginParams = neovimPlugins // { - inherit runCommand tree-sitter fetchFromGitHub fetchFromGitea; - inherit plugins enableDevIcons enableTabby enableOrgMode; + inherit tree-sitter plugins enableDevIcons enableTabby enableOrgMode; themeCfg = theme; lib = myLib; }; - callPlugin = op: - if isFunction op then op pluginParams else import op pluginParams; + callPlugin = plugin: callPackage plugin pluginParams; callPlugins = list: map callPlugin list; pluginsSettings = callPlugins [ diff --git a/plugins/ux/default.nix b/plugins/ux/default.nix index ebe3f02..38dea01 100644 --- a/plugins/ux/default.nix +++ b/plugins/ux/default.nix @@ -13,8 +13,9 @@ let hopLuaConfig = readFile ./hop-nvim.lua; + orgmodeEnable = lib.attrByPath [ "orgmode" "enable" ] enableOrgMode 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); colorizerSettings = lib.toLua (lib.attrByPath [ "colorizer" "settings" ] lib.mkLuaNil plugins); @@ -24,5 +25,5 @@ in luaConfig = hopLuaConfig + orgmodeLuaConfig + colorizerLuaConfig; plugins = [ hop-nvim nvim-colorizer ] - ++ lib.optional enableOrgMode [ nvim-orgmode org-bullets-nvim ]; + ++ lib.optional orgmodeEnable [ nvim-orgmode org-bullets-nvim ]; }