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

76 lines
1.6 KiB
Nix
Raw Normal View History

2022-11-30 22:49:32 +03:00
{ enableDevIcons ? false
, enableTabby ? false
, enableOrgMode ? false
, viAlias ? false
, vimAlias ? false
2022-11-30 22:52:01 +03:00
, extraConfig ? ""
, extraLuaConfig ? ""
2022-11-30 22:52:01 +03:00
, extraPlugins ? [ ]
2022-11-30 22:49:32 +03:00
, theme ? { }
, plugins ? { }
, wrapNeovim
, neovim-unwrapped
, tree-sitter
, neovimPlugins
, lib
, nix2lua
, substituteAll
2023-05-23 00:19:13 +03:00
, callPackage
2022-11-30 22:49:32 +03:00
, ...
}:
let
2023-05-23 00:19:13 +03:00
inherit (builtins) catAttrs readFile;
2023-06-09 14:37:25 +03:00
myLib = import ./lib.nix { inherit lib substituteAll; } // {
2023-05-22 15:17:52 +03:00
inherit (nix2lua.lib) toLua mkLuaNil;
2022-11-30 22:49:32 +03:00
};
pluginParams = neovimPlugins // {
2023-05-23 00:19:13 +03:00
inherit tree-sitter plugins enableDevIcons enableTabby enableOrgMode;
2022-11-30 22:49:32 +03:00
themeCfg = theme;
lib = myLib;
};
2023-05-23 00:19:13 +03:00
callPlugin = plugin: callPackage plugin pluginParams;
2022-11-30 22:49:32 +03:00
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;
allConfigs = basicConfigs ++ pluginConfigs ++ [ extraLuaConfig ];
2022-11-30 22:49:32 +03:00
in
(wrapNeovim neovim-unwrapped {
inherit viAlias;
inherit vimAlias;
withPython3 = false;
2023-06-09 15:31:58 +03:00
withNodeJs = false;
2022-11-30 22:49:32 +03:00
withRuby = false;
configure = {
customRC = extraConfig + myLib.mkLuaRc allConfigs;
2022-11-30 22:49:32 +03:00
packages.myVimPackages = { start = allPlugins; };
};
}).overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
nix2lua = nix2lua.lib;
inherit plugins;
};
})