pkg(nixvim): Add extra module to modify option
This commit is contained in:
parent
86f39ed4ce
commit
39ca09b05f
3 changed files with 49 additions and 2 deletions
|
|
@ -95,7 +95,7 @@
|
|||
};
|
||||
}
|
||||
];
|
||||
plugins.conform-nvim = {
|
||||
youthlic.plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings.formatters.injected.options.ignore_errors = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{...}: {
|
||||
plugins.lspconfig.enable = true;
|
||||
youthlic.plugins.lspconfig.enable = true;
|
||||
lsp = {
|
||||
inlayHints.enable = true;
|
||||
servers = {
|
||||
|
|
|
|||
47
pkgs/nixvim/module.nix
Normal file
47
pkgs/nixvim/module.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
cfg = config.youthlic;
|
||||
in {
|
||||
options = {
|
||||
youthlic.plugins = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule ({
|
||||
name,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
freeformType = lib.types.anything;
|
||||
options = {
|
||||
enable = lib.mkEnableOption "nvimPlugins.${name}";
|
||||
};
|
||||
}));
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
config = let
|
||||
enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins;
|
||||
in
|
||||
lib.mkMerge [
|
||||
{
|
||||
plugins = enabledPlugins;
|
||||
}
|
||||
{
|
||||
plugins = lib.pipe enabledPlugins [
|
||||
builtins.attrNames
|
||||
(lib.filter (name: options.plugins.${name} ? luaConfig))
|
||||
(map (name:
|
||||
lib.nameValuePair name {
|
||||
luaConfig.post =
|
||||
#lua
|
||||
''
|
||||
_M.load("${name}")
|
||||
'';
|
||||
}))
|
||||
lib.listToAttrs
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue