This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/default.nix

76 lines
1.6 KiB
Nix
Raw Normal View History

2022-09-19 18:44:57 +03:00
{ enableDevIcons ? false
, enableBarBar ? false
, enableTabby ? false
2022-10-22 23:35:27 +03:00
, enableOrgMode ? false
, viAlias ? false
, vimAlias ? false
, grammarFileTypes ? [ "nix" ]
2022-09-24 17:21:16 +03:00
, theme ? { }
2022-11-19 00:56:53 +03:00
, plugins ? { }
2022-09-18 12:15:44 +03:00
, wrapNeovim
, neovim-unwrapped
2022-09-24 17:21:16 +03:00
, tree-sitter
2022-11-17 23:44:45 +03:00
, neovimPlugins
2022-10-22 23:35:27 +03:00
, lib
2022-11-19 19:52:39 +03:00
, nix2lua
2022-11-19 00:56:53 +03:00
, substituteAll
2022-09-18 12:15:44 +03:00
, ...
}:
2022-09-15 01:29:25 +03:00
2022-09-15 09:57:11 +03:00
let
2022-10-22 23:35:27 +03:00
inherit (builtins) catAttrs isFunction readFile;
2022-11-19 19:52:39 +03:00
myLib = import ./lib.nix { inherit lib; } // {
inherit substituteAll;
inherit (nix2lua.lib) toLua;
};
2022-09-15 09:57:11 +03:00
2022-11-17 23:44:45 +03:00
pluginParams = neovimPlugins // {
2022-11-19 00:56:53 +03:00
inherit plugins;
2022-10-22 23:35:27 +03:00
inherit tree-sitter grammarFileTypes;
inherit enableDevIcons enableTabby enableOrgMode;
themeCfg = theme;
lib = myLib;
};
2022-10-22 23:35:27 +03:00
callPlugin = op:
if isFunction op then op pluginParams else import op pluginParams;
callPlugins = list: map callPlugin list;
2022-11-19 00:56:53 +03:00
pluginsSettings = callPlugins [
2022-09-19 19:03:40 +03:00
./plugins/config
2022-10-22 23:35:27 +03:00
./plugins/syntax
2022-09-18 16:32:54 +03:00
./plugins/git
2022-09-16 10:10:38 +03:00
./plugins/explorer
2022-10-22 23:35:27 +03:00
./plugins/theme
2022-09-16 10:10:38 +03:00
./plugins/lsp
2022-09-16 10:18:16 +03:00
./plugins/formatter
./plugins/ux
2022-09-15 09:57:11 +03:00
];
2022-11-17 23:44:45 +03:00
basePlugins = [ neovimPlugins.plenary-nvim ];
2022-11-19 00:56:53 +03:00
customPlugins = catAttrs "plugins" pluginsSettings;
2022-09-24 17:21:16 +03:00
allPlugins = basePlugins ++ customPlugins;
2022-10-22 23:35:27 +03:00
basicConfigs = map readFile [ ./config/basic.lua ];
2022-11-19 00:56:53 +03:00
pluginConfigs = catAttrs "luaConfig" pluginsSettings;
2022-09-16 10:10:38 +03:00
allConfigs = basicConfigs ++ pluginConfigs;
2022-09-15 09:57:11 +03:00
in
2022-11-19 19:52:39 +03:00
(wrapNeovim neovim-unwrapped {
inherit viAlias;
inherit vimAlias;
2022-09-15 01:29:25 +03:00
withPython3 = false;
withNodeJs = false;
withRuby = false;
configure = {
2022-10-22 23:35:27 +03:00
customRC = myLib.mkLuaRc allConfigs;
2022-09-15 01:29:25 +03:00
2022-09-24 17:21:16 +03:00
packages.myVimPackages = { start = allPlugins; };
2022-09-15 01:29:25 +03:00
};
2022-11-19 19:52:39 +03:00
}).overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
nix2lua = nix2lua.lib;
};
})