helpers: add mkPackageOption + refactoring (#144) (#150)

This commit is contained in:
Gaétan Lepage 2023-01-25 19:46:49 +01:00 committed by GitHub
parent d8a86e9b3f
commit c73bef16ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 112 additions and 263 deletions

View file

@ -2,16 +2,13 @@
with lib;
let
cfg = config.plugins.copilot;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
plugins.copilot = {
enable = mkEnableOption "copilot";
package = mkOption {
type = types.package;
description = "The copilot plugin package to use";
default = pkgs.vimPlugins.copilot-vim;
};
package = helpers.mkPackageOption "copilot" pkgs.vimPlugins.copilot-vim;
filetypes = mkOption {
type = types.attrsOf types.bool;
description = "A dictionary mapping file types to their enabled status";

View file

@ -2,7 +2,7 @@
with lib;
let
cfg = config.plugins.coq-nvim;
helpers = import ../helpers.nix { lib = lib; };
helpers = import ../helpers.nix { inherit lib; };
plugins = import ../plugin-defs.nix { inherit pkgs; };
in
@ -11,11 +11,7 @@ in
plugins.coq-nvim = {
enable = mkEnableOption "coq-nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.coq-vim;
description = "Plugin to use for coq-nvim";
};
package = helpers.mkPackageOption "coq-nvim" pkgs.vimPlugins.coq_nvim;
installArtifacts = mkEnableOption "Install coq-artifacts";

View file

@ -8,11 +8,7 @@ in
options.plugins.lspkind = {
enable = mkEnableOption "lspkind.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lspkind-nvim;
description = "Plugin to use for lspkind.nvim";
};
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
mode = mkOption {
type = with types; nullOr (enum [ "text" "text_symbol" "symbol_text" "symbol" ]);

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs:
let
helpers = import ../../helpers.nix { lib = lib; };
helpers = import ../../helpers.nix { inherit lib; };
in with helpers; with lib;
{
mkCmpSourcePlugin = { name, extraPlugins ? [], useDefaultPackage ? true, ... }: mkPlugin attrs {

View file

@ -2,7 +2,7 @@
with lib;
let
cfg = config.plugins.nvim-cmp;
helpers = import ../../helpers.nix { lib = lib; };
helpers = import ../../helpers.nix { inherit lib; };
mkNullOrOption = helpers.mkNullOrOption;
cmpLib = import ./cmp-helpers.nix args;
# functionName should be a string
@ -17,11 +17,7 @@ in
options.plugins.nvim-cmp = {
enable = mkEnableOption "nvim-cmp";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-cmp;
description = "Plugin to use for nvim-cmp";
};
package = helpers.mkPackageOption "nvim-cmp" pkgs.vimPlugins.nvim-cmp;
performance = mkOption {
default = null;