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
|
|
|
|
inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins;
|
2023-08-01 14:28:06 +00:00
|
|
|
inherit (builtins) map filter isString toString getAttr;
|
2023-10-03 17:48:09 +00:00
|
|
|
inherit (pkgs.vimUtils) buildVimPlugin;
|
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-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);
|
|
|
|
|
|
|
|
vimOptions = module.config.vim;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2023-08-01 14:28:06 +00:00
|
|
|
neovim = wrapNeovim vimOptions.package {
|
|
|
|
inherit (vimOptions) viAlias;
|
|
|
|
inherit (vimOptions) vimAlias;
|
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
configure = {
|
|
|
|
customRC = vimOptions.builtConfigRC;
|
|
|
|
|
|
|
|
packages.myVimPackage = {
|
|
|
|
start = buildConfigPlugins vimOptions.startPlugins;
|
|
|
|
opt = buildConfigPlugins vimOptions.optPlugins;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
inherit (module) options config;
|
|
|
|
inherit (module._module.args) pkgs;
|
|
|
|
inherit neovim;
|
|
|
|
}
|