From dc5d872e0b8a41d8c15bd5b3ad68578e8c7e724a Mon Sep 17 00:00:00 2001 From: janabhumi Date: Tue, 20 Sep 2022 09:17:40 +0300 Subject: [PATCH] nix: build plugins from input list --- flake.nix | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index 0e88b67..e66c18b 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ./. { };