1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

helpers: refactor mk[Neo]vimPlugin for colorschemes handling

This commit is contained in:
Gaetan Lepage 2024-03-12 22:30:45 +01:00 committed by Gaétan Lepage
parent 61ee0552c9
commit cf7102c6d2
5 changed files with 18 additions and 19 deletions

View file

@ -6,7 +6,6 @@
with lib; {
mkVimPlugin = config: {
name,
colorscheme ? false,
url ?
if defaultPackage != null
then defaultPackage.meta.homepage
@ -16,6 +15,9 @@ with lib; {
# deprecations
deprecateExtraConfig ? false,
optionsRenamedToSettings ? [],
# colorscheme
isColorscheme ? false,
colorscheme ? name,
# options
originalName ? name,
defaultPackage ? null,
@ -30,7 +32,7 @@ with lib; {
extraPackages ? [],
}: let
namespace =
if colorscheme
if isColorscheme
then "colorschemes"
else "plugins";
@ -127,10 +129,8 @@ with lib; {
# does this evaluate package? it would not be desired to evaluate package if we use another package.
extraPlugins = extraPlugins ++ optional (defaultPackage != null) cfg.package;
}
(optionalAttrs colorscheme {
# We use `mkDefault` here to let individual plugins override this option.
# For instance, setting it to `null` a specific way of setting the coloscheme.
colorscheme = lib.mkDefault name;
(optionalAttrs (isColorscheme && (colorscheme != null)) {
inherit colorscheme;
})
(extraConfig cfg)
]