colorschemes/nord: switch to mkPlugin

This commit is contained in:
Gaetan Lepage 2024-01-08 15:24:05 +01:00 committed by Gaétan Lepage
parent 20c1ae069e
commit 3be30efc3b

View file

@ -1,58 +1,51 @@
{ {
lib, lib,
helpers,
config,
pkgs, pkgs,
... ...
}: } @ args:
with lib; let with lib;
cfg = config.colorschemes.nord; with import ../helpers.nix {inherit lib;};
in { mkPlugin args {
options = { name = "nord";
colorschemes.nord = { description = "nord.nvim";
enable = mkEnableOption "nord"; package = pkgs.vimPlugins.nord-nvim;
globalPrefix = "nord_";
package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim; options = {
contrast = mkDefaultOpt {
type = types.bool;
description = ''
Make sidebars and popup menus like nvim-tree and telescope have a different background.
'';
};
contrast = borders = mkDefaultOpt {
mkEnableOption type = types.bool;
"Make sidebars and popup menus like nvim-tree and telescope have a different background"; description = "Enable the border between verticaly split windows visable.";
};
borders = disable_background = mkDefaultOpt {
mkEnableOption type = types.bool;
"Enable the border between verticaly split windows visable"; description = ''
Disable the setting of background color so that NeoVim can use your terminal background.
'';
};
disable_background = cursorline_transparent = mkDefaultOpt {
mkEnableOption type = types.bool;
"Disable the setting of background color so that NeoVim can use your terminal background"; description = "Set the cursorline transparent/visible.";
};
cursorline_transparent = enable_sidebar_background = mkDefaultOpt {
mkEnableOption type = types.bool;
"Set the cursorline transparent/visible"; description = ''
Re-enables the background of the sidebar if you disabled the background of everything.
'';
};
enable_sidebar_background = italic = mkDefaultOpt {
mkEnableOption type = types.bool;
"Re-enables the background of the sidebar if you disabled the background of everything"; description = "Enables/disables italics.";
italic = mkOption {
description = "enables/disables italics";
type = types.nullOr types.bool;
default = null;
}; };
}; };
}; }
config = mkIf cfg.enable {
colorscheme = "nord";
extraPlugins = [cfg.package];
globals = {
nord_contrast = mkIf cfg.contrast 1;
nord_borders = mkIf cfg.borders 1;
nord_disable_background = mkIf cfg.disable_background 1;
nord_cursoline_transparent = mkIf cfg.cursorline_transparent 1;
nord_enable_sidebar_background = mkIf cfg.enable_sidebar_background 1;
nord_italic = mkIf (cfg.italic != null) cfg.italic;
};
};
}