nix: build plugins from input list

This commit is contained in:
Dmitriy Pleshevskiy 2022-09-20 09:17:40 +03:00
parent 2d1b7d554f
commit dc5d872e0b
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -27,32 +27,32 @@
outputs = inputs @ { self, nixpkgs, utils, ... }:
utils.lib.eachDefaultSystem (system:
let
inputPlugins = [
"tabby-nvim"
"editorconfig-nvim"
"telescope-live-grep-args-nvim"
"lspsaga-nvim"
];
pkgs = import nixpkgs {
inherit system;
overlays = [
(f: p: {
vimPlugins = p.vimPlugins // {
# TODO: make util to build plugins from array
tabby-nvim = p.vimUtils.buildVimPluginFrom2Nix {
name = "tabby-nvim";
src = inputs.tabby-nvim;
};
editorconfig-nvim = p.vimUtils.buildVimPluginFrom2Nix {
name = "editorconfig-nvim";
src = inputs.editorconfig-nvim;
};
telescope-live-grep-args-nvim = p.vimUtils.buildVimPluginFrom2Nix {
name = "telescope-live-grep-args-nvim";
src = inputs.telescope-live-grep-args-nvim;
};
lspsaga-nvim = p.vimUtils.buildVimPluginFrom2Nix {
name = "lspsaga-nvim";
src = inputs.lspsaga-nvim;
};
};
})
];
(f: p:
let
inherit (p.lib) listToAttrs nameValuePair;
buildPlugin = name: p.vimUtils.buildVimPluginFrom2Nix {
name = name;
src = builtins.getAttr name inputs;
};
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
customPlugins = listToAttrs (builtins.map buildPluginValuePair inputPlugins);
in
{ vimPlugins = p.vimPlugins // customPlugins; }
)
];
};
neovim = pkgs.callPackage ./. { };