From 9f2d766f28e1ef92a5c27eff6dadca51abacdeb7 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 16 Jan 2024 00:06:44 +0100 Subject: [PATCH] Revert "colorschemes/nord: switch to mkPlugin" This reverts commit 3be30efc3b0297d9fae9d9feaacfce33de7887f0. --- plugins/colorschemes/nord.nix | 85 +++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/plugins/colorschemes/nord.nix b/plugins/colorschemes/nord.nix index bafbf611..76c1c2f3 100644 --- a/plugins/colorschemes/nord.nix +++ b/plugins/colorschemes/nord.nix @@ -1,51 +1,58 @@ { lib, + helpers, + config, pkgs, ... -} @ args: -with lib; -with import ../helpers.nix {inherit lib;}; - mkPlugin args { - name = "nord"; - description = "nord.nvim"; - package = pkgs.vimPlugins.nord-nvim; - globalPrefix = "nord_"; +}: +with lib; let + cfg = config.colorschemes.nord; +in { + options = { + colorschemes.nord = { + enable = mkEnableOption "nord"; - options = { - contrast = mkDefaultOpt { - type = types.bool; - description = '' - Make sidebars and popup menus like nvim-tree and telescope have a different background. - ''; - }; + package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim; - borders = mkDefaultOpt { - type = types.bool; - description = "Enable the border between verticaly split windows visable."; - }; + contrast = + mkEnableOption + "Make sidebars and popup menus like nvim-tree and telescope have a different background"; - disable_background = mkDefaultOpt { - type = types.bool; - description = '' - Disable the setting of background color so that NeoVim can use your terminal background. - ''; - }; + borders = + mkEnableOption + "Enable the border between verticaly split windows visable"; - cursorline_transparent = mkDefaultOpt { - type = types.bool; - description = "Set the cursorline transparent/visible."; - }; + disable_background = + mkEnableOption + "Disable the setting of background color so that NeoVim can use your terminal background"; - enable_sidebar_background = mkDefaultOpt { - type = types.bool; - description = '' - Re-enables the background of the sidebar if you disabled the background of everything. - ''; - }; + cursorline_transparent = + mkEnableOption + "Set the cursorline transparent/visible"; - italic = mkDefaultOpt { - type = types.bool; - description = "Enables/disables italics."; + enable_sidebar_background = + mkEnableOption + "Re-enables the background of the sidebar if you disabled the background of everything"; + + 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; + }; + }; +}