pkg(nixvim): Add extra module to modify option

This commit is contained in:
ulic-youthlic 2025-07-13 06:04:55 +08:00
parent 86f39ed4ce
commit 39ca09b05f
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
3 changed files with 49 additions and 2 deletions

View file

@ -95,7 +95,7 @@
};
}
];
plugins.conform-nvim = {
youthlic.plugins.conform-nvim = {
enable = true;
settings.formatters.injected.options.ignore_errors = true;
};

View file

@ -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
View 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
];
}
];
}