2023-02-10 17:39:31 +00:00
|
|
|
inputs: {
|
2023-02-01 19:11:37 +00:00
|
|
|
configuration,
|
|
|
|
pkgs,
|
|
|
|
lib ? pkgs.lib,
|
|
|
|
check ? true,
|
|
|
|
extraSpecialArgs ? {},
|
|
|
|
}: let
|
2023-08-01 14:28:06 +00:00
|
|
|
inherit (builtins) map filter isString toString getAttr;
|
2024-02-29 20:15:47 +00:00
|
|
|
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
2023-10-03 17:48:09 +00:00
|
|
|
inherit (pkgs.vimUtils) buildVimPlugin;
|
2024-02-29 20:15:47 +00:00
|
|
|
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2023-02-06 18:58:23 +00:00
|
|
|
extendedLib = import ../lib/stdlib-extended.nix lib;
|
2023-02-01 19:11:37 +00:00
|
|
|
|
|
|
|
nvimModules = import ./modules.nix {
|
|
|
|
inherit check pkgs;
|
|
|
|
lib = extendedLib;
|
|
|
|
};
|
|
|
|
|
|
|
|
module = extendedLib.evalModules {
|
|
|
|
modules = [configuration] ++ nvimModules;
|
2023-08-01 14:28:06 +00:00
|
|
|
specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs;
|
2023-02-01 19:11:37 +00:00
|
|
|
};
|
|
|
|
|
2023-11-06 09:33:38 +00:00
|
|
|
vimOptions = module.config.vim;
|
|
|
|
|
2024-02-17 22:03:47 +00:00
|
|
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
|
|
|
|
2023-06-25 12:09:12 +00:00
|
|
|
buildPlug = {pname, ...} @ args:
|
|
|
|
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
2023-10-03 17:48:09 +00:00
|
|
|
buildVimPlugin (args
|
2023-06-25 12:09:12 +00:00
|
|
|
// {
|
|
|
|
version = "master";
|
|
|
|
src = getAttr pname inputs;
|
|
|
|
});
|
2023-02-01 19:11:37 +00:00
|
|
|
|
|
|
|
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
|
|
|
|
|
|
|
buildConfigPlugins = plugins:
|
|
|
|
map
|
|
|
|
(plug: (
|
|
|
|
if (isString plug)
|
|
|
|
then
|
|
|
|
(
|
|
|
|
if (plug == "nvim-treesitter")
|
|
|
|
then (buildTreesitterPlug vimOptions.treesitter.grammars)
|
2023-06-25 12:09:12 +00:00
|
|
|
else if (plug == "flutter-tools-patched")
|
|
|
|
then
|
|
|
|
(buildPlug {
|
|
|
|
pname = "flutter-tools";
|
|
|
|
patches = [../patches/flutter-tools.patch];
|
|
|
|
})
|
|
|
|
else (buildPlug {pname = plug;})
|
2023-02-01 19:11:37 +00:00
|
|
|
)
|
|
|
|
else plug
|
|
|
|
))
|
|
|
|
(filter
|
|
|
|
(f: f != null)
|
|
|
|
plugins);
|
|
|
|
|
2024-02-29 20:15:47 +00:00
|
|
|
plugins =
|
|
|
|
(buildConfigPlugins vimOptions.startPlugins)
|
|
|
|
++ (map (package: {
|
|
|
|
plugin = package;
|
|
|
|
optional = false;
|
|
|
|
})
|
|
|
|
(buildConfigPlugins
|
|
|
|
vimOptions.optPlugins));
|
|
|
|
|
|
|
|
neovim = wrapNeovimUnstable vimOptions.package (makeNeovimConfig {
|
2023-08-01 14:28:06 +00:00
|
|
|
inherit (vimOptions) viAlias;
|
|
|
|
inherit (vimOptions) vimAlias;
|
2024-02-17 22:03:47 +00:00
|
|
|
inherit extraLuaPackages;
|
2024-02-29 20:15:47 +00:00
|
|
|
inherit plugins;
|
|
|
|
customRC = vimOptions.builtConfigRC;
|
|
|
|
});
|
2023-02-01 19:11:37 +00:00
|
|
|
in {
|
|
|
|
inherit (module) options config;
|
|
|
|
inherit (module._module.args) pkgs;
|
|
|
|
inherit neovim;
|
|
|
|
}
|