robin/weave

simple neovim wrapper for nix

git clone https://git.robinwobin.dev/robin/weave

robinwrapper: add plugins supportbf40ced

main
879 B56 linesraw
1{
2  lib,
3  newScope,
4  vimUtils,
5
6  pins,
7  pluginOverrides ? { },
8}:
9let
10  inherit (lib) makeScope;
11  inherit (builtins)
12    mapAttrs
13    ;
14
15  sources = mapAttrs (
16    n: v:
17    let
18      src = v { };
19    in
20    {
21      inherit src;
22      passthru.as = n;
23    }
24  ) pins;
25
26  mkPlugin =
27    name: args:
28    let
29      oa = sources.${name} or { };
30      pkg = oa // args;
31
32      passthru = {
33        as = name;
34        start = false;
35      }
36      // pkg.passthru;
37    in
38    vimUtils.buildVimPlugin (
39      pkg
40      // {
41        pname = pkg.pname or passthru.as;
42        version = "0-dev${pkg.src.revision}";
43
44        doCheck = false;
45
46        inherit passthru;
47      }
48    );
49
50  generatedPlugins = mapAttrs (n: _: mkPlugin n { }) sources;
51
52  plugins' = mapAttrs (n: v: mkPlugin n v) pluginOverrides;
53
54  plugins = generatedPlugins // plugins';
55in
56makeScope newScope (_: plugins)