forked from NixNeovim/NixNeovim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin_template.nix
46 lines (37 loc) · 1.08 KB
/
plugin_template.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ pkgs, lib, helpers, config }:
with lib;
let
inherit (helpers.generator)
mkLuaPlugin;
inherit (helpers.converter)
flattenModuleOptions
toLuaObject;
name = "PLUGIN_NAME";
pluginUrl = "PLUGIN_URL";
cfg = config.programs.nixneovim.plugins.${name};
moduleOptions = with helpers; {
# add module options here
#
# autoStart = boolOption true "Enable this pugin at start"
};
# pluginOptions = {
# # manually add plugin mapping of module options here
# #
# # auto_start = cfg.autoStart
# };
# you can autogenerate the plugin options from the moduleOptions.
# This essentially converts the camalCase moduleOptions to snake_case plugin options
pluginOptions = flattenModuleOptions cfg moduleOptions;
in mkLuaPlugin {
inherit name moduleOptions pluginUrl;
extraPlugins = with pkgs.vimExtraPlugins; [
# add neovim plugin here
# nvim-treesitter
];
extraPackages = with pkgs; [
# add dependencies here
# tree-sitter
];
extraConfigLua = "require('${name}').setup ${toLuaObject pluginOptions}";
defaultRequire = false;
}