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/neovim.nix

79 lines
1.7 KiB
Nix
Raw Normal View History

2022-11-30 22:49:32 +03:00
{ enableDevIcons ? false
, enableBarBar ? false
, enableTabby ? false
, enableOrgMode ? false
, viAlias ? false
, vimAlias ? false
2022-11-30 22:52:01 +03:00
, extraConfig ? ""
, extraPlugins ? [ ]
2022-11-30 22:49:32 +03:00
, theme ? { }
, plugins ? { }
, wrapNeovim
, runCommand
2022-11-30 22:49:32 +03:00
, neovim-unwrapped
, tree-sitter
, neovimPlugins
, lib
, nix2lua
, substituteAll
2022-12-12 21:50:03 +03:00
, fetchFromGitHub
2022-11-30 22:49:32 +03:00
, ...
}:
let
inherit (builtins) catAttrs isFunction readFile;
myLib = import ./lib.nix { inherit lib; } // {
inherit substituteAll;
inherit (nix2lua.lib) toLua;
};
pluginParams = neovimPlugins // {
inherit runCommand tree-sitter fetchFromGitHub;
2022-12-12 21:50:03 +03:00
inherit plugins enableDevIcons enableTabby enableOrgMode;
2022-11-30 22:49:32 +03:00
themeCfg = theme;
lib = myLib;
};
callPlugin = op:
if isFunction op then op pluginParams else import op pluginParams;
callPlugins = list: map callPlugin list;
pluginsSettings = callPlugins [
./plugins/config
./plugins/syntax
./plugins/git
./plugins/explorer
./plugins/theme
./plugins/lsp
./plugins/formatter
./plugins/ux
];
basePlugins = [ neovimPlugins.plenary-nvim ];
customPlugins = catAttrs "plugins" pluginsSettings;
2022-11-30 22:52:01 +03:00
allPlugins = basePlugins ++ customPlugins ++ extraPlugins;
2022-11-30 22:49:32 +03:00
basicConfigs = map readFile [ ./config/basic.lua ];
pluginConfigs = catAttrs "luaConfig" pluginsSettings;
2022-11-30 22:52:01 +03:00
allConfigs = basicConfigs ++ pluginConfigs ++ [ extraConfig ];
2022-11-30 22:49:32 +03:00
in
(wrapNeovim neovim-unwrapped {
inherit viAlias;
inherit vimAlias;
withPython3 = false;
withNodeJs = false;
withRuby = false;
configure = {
customRC = myLib.mkLuaRc allConfigs;
packages.myVimPackages = { start = allPlugins; };
};
}).overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
nix2lua = nix2lua.lib;
inherit plugins;
};
})