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

@ -58,7 +58,7 @@
modules = nixvimModules; modules = nixvimModules;
}; };
runUpdates = pkgs.callPackage runUpdates = pkgs.callPackage
({ pkgs, stdenv }: stdenv.mkDerivation { ({ pkgs, stdenv }: stdenv.mkDerivation {
pname = "run-updates"; pname = "run-updates";
version = pkgs.rust-analyzer.version; version = pkgs.rust-analyzer.version;
@ -67,7 +67,7 @@
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra nixpkgs-fmt]; nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra nixpkgs-fmt];
buildPhase = '' buildPhase = ''
extract_rust_analyzer.py editors/code/package.json | extract_rust_analyzer.py editors/code/package.json |
alejandra --quiet | alejandra --quiet |
nixpkgs-fmt > rust-analyzer-config.nix nixpkgs-fmt > rust-analyzer-config.nix
''; '';

View file

@ -92,6 +92,12 @@ rec {
mkEnumFirstDefault = enum: mkEnum enum (head enum); mkEnumFirstDefault = enum: mkEnum enum (head enum);
}; };
mkPackageOption = name: default: mkOption {
type = types.package;
inherit default;
description = "Plugin to use for ${name}";
};
mkPlugin = { config, lib, ... }: { name mkPlugin = { config, lib, ... }: { name
, description , description
, package ? null , package ? null
@ -112,11 +118,7 @@ rec {
options; options;
# does this evaluate package? # does this evaluate package?
packageOption = if package == null then { } else { packageOption = if package == null then { } else {
package = mkOption { package = mkPackageOption name package;
type = types.package;
default = package;
description = "Plugin to use for ${name}";
};
}; };
in in
{ {

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
let let
helpers = import ../plugins/helpers.nix { inherit lib; }; helpers = import ../lib/helpers.nix { inherit lib; };
in in
with lib; with lib;
{ {

View file

@ -1,7 +1,7 @@
{ config, lib, ... }: { config, lib, ... }:
with lib; with lib;
let let
helpers = import ../plugins/helpers.nix { inherit lib; }; helpers = import ../lib/helpers.nix { inherit lib; };
mapOption = types.oneOf [ mapOption = types.oneOf [
types.str types.str

View file

@ -1,7 +1,7 @@
{ config, lib, ... }: { config, lib, ... }:
with lib; with lib;
let let
helpers = import ../plugins/helpers.nix { inherit lib; }; helpers = import ../lib/helpers.nix { inherit lib; };
in in
{ {
options = { options = {

View file

@ -2,16 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.barbar; cfg = config.plugins.barbar;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options.plugins.barbar = { options.plugins.barbar = {
enable = mkEnableOption "barbar.nvim"; enable = mkEnableOption "barbar.nvim";
package = mkOption { package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
type = types.package;
default = pkgs.vimPlugins.barbar-nvim;
description = "Plugin to use for barbar";
};
animations = mkOption { animations = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;

View file

@ -34,11 +34,7 @@ in
options = { options = {
plugins.bufferline = { plugins.bufferline = {
enable = mkEnableOption "bufferline"; enable = mkEnableOption "bufferline";
package = mkOption { package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim;
type = types.package;
description = "Plugin to use for bufferline";
default = pkgs.vimPlugins.bufferline-nvim;
};
numbers = mkOption { numbers = mkOption {
type = types.nullOr types.lines; type = types.nullOr types.lines;
description = "A lua function customizing the styling of numbers."; description = "A lua function customizing the styling of numbers.";

View file

@ -2,6 +2,7 @@
with lib; with lib;
let let
cfg = config.colorschemes.base16; cfg = config.colorschemes.base16;
helpers = import ../helpers.nix { inherit lib; };
themes = import ./base16-list.nix; themes = import ./base16-list.nix;
in in
{ {
@ -9,11 +10,7 @@ in
colorschemes.base16 = { colorschemes.base16 = {
enable = mkEnableOption "base16"; enable = mkEnableOption "base16";
package = mkOption { package = helpers.mkPackageOption "base16" pkgs.vimPlugins.base16-vim;
type = types.package;
default = pkgs.vimPlugins.base16-vim;
description = "Plugin to use for base16";
};
useTruecolor = mkOption { useTruecolor = mkOption {
type = types.bool; type = types.bool;

View file

@ -2,6 +2,7 @@
with lib; with lib;
let let
cfg = config.colorschemes.gruvbox; cfg = config.colorschemes.gruvbox;
helpers = import ../helpers.nix { inherit lib; };
colors = types.enum [ "bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4" ]; colors = types.enum [ "bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4" ];
in in
{ {
@ -9,11 +10,7 @@ in
colorschemes.gruvbox = { colorschemes.gruvbox = {
enable = mkEnableOption "gruvbox"; enable = mkEnableOption "gruvbox";
package = mkOption { package = helpers.mkPackageOption "gruvbox" pkgs.vimPlugins.gruvbox-nvim;
type = types.package;
default = pkgs.vimPlugins.gruvbox-nvim;
description = "Plugin to use for gruvbox";
};
italics = mkEnableOption "italics"; italics = mkEnableOption "italics";
bold = mkEnableOption "bold"; bold = mkEnableOption "bold";

View file

@ -2,17 +2,14 @@
with lib; with lib;
let let
cfg = config.colorschemes.nord; cfg = config.colorschemes.nord;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {
colorschemes.nord = { colorschemes.nord = {
enable = mkEnableOption "nord"; enable = mkEnableOption "nord";
package = mkOption { package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim;
type = types.package;
default = pkgs.vimPlugins.nord-nvim;
description = "Plugin to use for nord.nvim";
};
contrast = mkEnableOption contrast = mkEnableOption
"Make sidebars and popup menus like nvim-tree and telescope have a different background"; "Make sidebars and popup menus like nvim-tree and telescope have a different background";

View file

@ -2,17 +2,14 @@
with lib; with lib;
let let
cfg = config.colorschemes.one; cfg = config.colorschemes.one;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {
colorschemes.one = { colorschemes.one = {
enable = mkEnableOption "vim-one"; enable = mkEnableOption "vim-one";
package = mkOption { package = helpers.mkPackageOption "one" pkgs.vimPlugins.vim-one;
type = types.package;
default = pkgs.vimPlugins.vim-one;
description = "Plugin to use for one";
};
}; };
}; };

View file

@ -2,17 +2,14 @@
with lib; with lib;
let let
cfg = config.colorschemes.onedark; cfg = config.colorschemes.onedark;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {
colorschemes.onedark = { colorschemes.onedark = {
enable = mkEnableOption "onedark"; enable = mkEnableOption "onedark";
package = mkOption { package = helpers.mkPackageOption "one" pkgs.vimPlugins.onedark-vim;
type = types.package;
default = pkgs.vimPlugins.onedark-vim;
description = "Plugin to use for one";
};
}; };
}; };

View file

@ -9,11 +9,7 @@ in
options = { options = {
colorschemes.tokyonight = { colorschemes.tokyonight = {
enable = mkEnableOption "tokyonight"; enable = mkEnableOption "tokyonight";
package = mkOption { package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
type = types.package;
default = pkgs.vimPlugins.tokyonight-nvim;
description = "Plugin to use for tokyonight";
};
style = mkOption { style = mkOption {
type = style; type = style;
default = "storm"; default = "storm";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "fugitive"; name = "fugitive";

View file

@ -9,11 +9,7 @@ in
plugins.gitgutter = { plugins.gitgutter = {
enable = mkEnableOption "gitgutter"; enable = mkEnableOption "gitgutter";
package = mkOption { package = helpers.mkPackageOption "gitgutter" pkgs.vimPlugins.gitgutter;
type = types.package;
default = pkgs.vimPlugins.gitgutter;
description = "Plugin to use for gitgutter";
};
recommendedSettings = mkOption { recommendedSettings = mkOption {
type = types.bool; type = types.bool;

View file

@ -37,11 +37,7 @@ in
{ {
options.plugins.gitsigns = { options.plugins.gitsigns = {
enable = mkEnableOption "Enable gitsigns plugin"; enable = mkEnableOption "Enable gitsigns plugin";
package = mkOption { package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim;
type = types.package;
default = pkgs.vimPlugins.gitsigns-nvim;
description = "Plugin to use for gitsigns";
};
signs = { signs = {
add = signOptions { add = signOptions {
hl = "GitSignsAdd"; hl = "GitSignsAdd";

View file

@ -18,11 +18,7 @@ in
plugins.neogit = { plugins.neogit = {
enable = mkEnableOption "neogit"; enable = mkEnableOption "neogit";
package = mkOption { package = helpers.mkPackageOption "neogit" pkgs.vimPlugins.neogit;
type = types.package;
default = pkgs.vimPlugins.neogit;
description = "Plugin to use for neogit";
};
disableSigns = mkOption { disableSigns = mkOption {
description = "Disable signs"; description = "Disable signs";

View file

@ -1,2 +1 @@
args: import ../lib/helpers.nix args args: import ../lib/helpers.nix args

View file

@ -1,5 +1,5 @@
{ pkgs, lib, ... }@args: { pkgs, lib, ... }@args:
with lib; with import ../helpers.nix { lib = lib; }; with lib; with import ../helpers.nix { inherit lib; };
mkPlugin args { mkPlugin args {
name = "ledger"; name = "ledger";
description = "Enable ledger language features"; description = "Enable ledger language features";

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "nix"; name = "nix";

View file

@ -3,15 +3,14 @@
, config , config
, ... , ...
}: }:
with lib; { with lib;
let
helpers = import ../helpers.nix { inherit lib; };
in {
options.plugins.plantuml-syntax = { options.plugins.plantuml-syntax = {
enable = mkEnableOption "plantuml syntax support"; enable = mkEnableOption "plantuml syntax support";
package = mkOption { package = helpers.mkPackageOption "plantuml-syntax" pkgs.vimPlugins.plantuml-syntax;
type = types.package;
default = pkgs.vimPlugins.plantuml-syntax;
description = "Plugin to use for plantuml-syntax";
};
setMakeprg = mkOption { setMakeprg = mkOption {
type = types.bool; type = types.bool;

View file

@ -1,10 +1,12 @@
{ pkgs { pkgs
, config , config
, lib , lib
, helpers
, ... , ...
}: }:
with lib; { with lib;
let
helpers = import ../helpers.nix { inherit lib; };
in {
options.plugins.rust-tools = options.plugins.rust-tools =
let let
mkNullableOptionWithDefault = mkNullableOptionWithDefault =
@ -46,11 +48,7 @@ with lib; {
in in
{ {
enable = mkEnableOption "rust tools plugins"; enable = mkEnableOption "rust tools plugins";
package = mkOption { package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
type = types.package;
default = pkgs.vimPlugins.rust-tools-nvim;
description = "Package to use for rust-tools";
};
serverPackage = mkOption { serverPackage = mkOption {
type = types.package; type = types.package;
default = pkgs.rust-analyzer; default = pkgs.rust-analyzer;

View file

@ -3,15 +3,14 @@
, config , config
, ... , ...
}: }:
with lib; { with lib;
let
helpers = import ../helpers.nix { inherit lib; };
in {
options.plugins.treesitter-context = { options.plugins.treesitter-context = {
enable = mkEnableOption "nvim-treesitter-context"; enable = mkEnableOption "nvim-treesitter-context";
package = mkOption { package = helpers.mkPackageOption "treesitter-context" pkgs.vimPlugins.nvim-treesitter-context;
type = types.package;
default = pkgs.vimPlugins.nvim-treesitter-context;
description = "Plugin to use for nvim-treesitter-context";
};
maxLines = mkOption { maxLines = mkOption {
type = types.nullOr types.ints.positive; type = types.nullOr types.ints.positive;

View file

@ -3,7 +3,11 @@
, lib , lib
, ... , ...
}: }:
with lib; { with lib;
let
helpers = import ../helpers.nix { inherit lib; };
in
{
options.plugins.treesitter-refactor = options.plugins.treesitter-refactor =
let let
disable = mkOption { disable = mkOption {
@ -17,11 +21,7 @@ with lib; {
mkEnableOption mkEnableOption
"treesitter-refactor (requires plugins.treesitter.enable to be true)"; "treesitter-refactor (requires plugins.treesitter.enable to be true)";
package = mkOption { package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor;
type = types.package;
default = pkgs.vimPlugins.nvim-treesitter-refactor;
description = "Plugin to use for treesitter-refactor";
};
highlightDefinitions = { highlightDefinitions = {
inherit disable; inherit disable;

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "zig"; name = "zig";

View file

@ -2,18 +2,14 @@
with lib; with lib;
let let
cfg = config.plugins.lsp-lines; cfg = config.plugins.lsp-lines;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {
plugins.lsp-lines = { plugins.lsp-lines = {
enable = mkEnableOption "lsp_lines.nvim"; enable = mkEnableOption "lsp_lines.nvim";
package = mkOption { package = helpers.mkPackageOption "lsp_lines.nvim" pkgs.vimPlugins.lsp_lines-nvim;
type = types.package;
default = pkgs.vimPlugins.lsp_lines-nvim;
description = "Plugin to use for lsp_lines.nvim";
};
currentLine = mkOption { currentLine = mkOption {
type = types.bool; type = types.bool;

View file

@ -2,18 +2,14 @@
with lib; with lib;
let let
cfg = config.plugins.lspsaga; cfg = config.plugins.lspsaga;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {
plugins.lspsaga = { plugins.lspsaga = {
enable = mkEnableOption "lspsaga.nvim"; enable = mkEnableOption "lspsaga.nvim";
package = mkOption { package = helpers.mkPackageOption "lspsaga" pkgs.vimPlugins.lspsaga-nvim;
type = types.package;
default = pkgs.vimPlugins.lspsaga-nvim;
description = "Plugin to use for lspsaga.nvim";
};
signs = { signs = {
use = mkOption { use = mkOption {

View file

@ -10,11 +10,7 @@ with lib; {
options.plugins.nvim-lightbulb = { options.plugins.nvim-lightbulb = {
enable = mkEnableOption "nvim-lightbulb, showing available code actions"; enable = mkEnableOption "nvim-lightbulb, showing available code actions";
package = mkOption { package = helpers.mkPackageOption "nvim-lightbulb" pkgs.vimPlugins.nvim-lightbulb;
type = types.package;
default = pkgs.vimPlugins.nvim-lightbulb;
description = "Plugin to use for nvim-lightbulb";
};
ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
LSP client names to ignore LSP client names to ignore

View file

@ -9,11 +9,7 @@ with lib;
options.plugins.trouble = { options.plugins.trouble = {
enable = mkEnableOption "trouble.nvim"; enable = mkEnableOption "trouble.nvim";
package = mkOption { package = helpers.mkPackageOption "trouble-nvim" pkgs.vimPlugins.trouble-nvim;
type = types.package;
default = pkgs.vimPlugins.trouble-nvim;
description = "Plugin to use for trouble-nvim";
};
position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list"; position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list";
height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom"; height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom";

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.packer; cfg = config.plugins.packer;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options = { options = {

View file

@ -2,17 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.luasnip; cfg = config.plugins.luasnip;
helpers = import ../../helpers.nix { lib = lib; }; helpers = import ../../helpers.nix { inherit lib; };
in in
{ {
options.plugins.luasnip = { options.plugins.luasnip = {
enable = mkEnableOption "Enable luasnip"; enable = mkEnableOption "Enable luasnip";
package = mkOption { package = helpers.mkPackageOption "luasnip" pkgs.vimPlugins.luasnip;
default = pkgs.vimPlugins.luasnip;
type = types.package;
description = "Plugin to use for luasnip";
};
fromVscode = mkOption { fromVscode = mkOption {
default = [ ]; default = [ ];

View file

@ -16,11 +16,7 @@ in
plugins.airline = { plugins.airline = {
enable = mkEnableOption "airline"; enable = mkEnableOption "airline";
package = mkOption { package = helpers.mkPackageOption "airline" pkgs.vimPlugins.vim-airline;
type = types.package;
default = pkgs.vimPlugins.vim-airline;
description = "Plguin to use for airline";
};
extensions = mkOption { extensions = mkOption {
default = null; default = null;

View file

@ -9,11 +9,7 @@ in
plugins.lightline = { plugins.lightline = {
enable = mkEnableOption "lightline"; enable = mkEnableOption "lightline";
package = mkOption { package = helpers.mkPackageOption "lightline" pkgs.vimPlugins.lightline-vim;
type = types.package;
default = pkgs.vimPlugins.lightline-vim;
description = "Plugin to use for lightline";
};
colorscheme = mkOption { colorscheme = mkOption {
type = with types; nullOr str; type = with types; nullOr str;

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.lualine; cfg = config.plugins.lualine;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
separators = mkOption { separators = mkOption {
type = types.nullOr (types.submodule { type = types.nullOr (types.submodule {
options = { options = {
@ -58,11 +58,7 @@ in
plugins.lualine = { plugins.lualine = {
enable = mkEnableOption "lualine"; enable = mkEnableOption "lualine";
package = mkOption { package = helpers.mkPackageOption "lualine" pkgs.vimPlugins.lualine-nvim;
type = types.package;
default = pkgs.vimPlugins.lualine-nvim;
description = "Plugin to use for lualine";
};
theme = mkOption { theme = mkOption {
default = config.colorscheme; default = config.colorscheme;

View file

@ -1,8 +1,12 @@
{ pkgs, config, lib, ... }: { pkgs
, config
, lib
, ...
}:
with lib; with lib;
let let
cfg = config.plugins.telescope; cfg = config.plugins.telescope;
helpers = (import ../helpers.nix { inherit lib; }); helpers = import ../helpers.nix { inherit lib; };
in in
{ {
imports = [ imports = [
@ -18,11 +22,7 @@ in
options.plugins.telescope = { options.plugins.telescope = {
enable = mkEnableOption "telescope.nvim"; enable = mkEnableOption "telescope.nvim";
package = mkOption { package = helpers.mkPackageOption "telescope.nvim" pkgs.vimPlugins.telescope-nvim;
type = types.package;
default = pkgs.vimPlugins.telescope-nvim;
description = "Plugin to use for telescope.nvim";
};
highlightTheme = mkOption { highlightTheme = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;

View file

@ -2,16 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.telescope.extensions.frecency; cfg = config.plugins.telescope.extensions.frecency;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options.plugins.telescope.extensions.frecency = { options.plugins.telescope.extensions.frecency = {
enable = mkEnableOption "frecency"; enable = mkEnableOption "frecency";
package = mkOption { package = helpers.mkPackageOption "telescope extension frecency" pkgs.vimPlugins.telescope-frecency-nvim;
type = types.package;
default = pkgs.vimPlugins.telescope-frecency-nvim;
description = "Plugin to use for telescope frecency";
};
dbRoot = mkOption { dbRoot = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;

View file

@ -2,16 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.telescope.extensions.fzf-native; cfg = config.plugins.telescope.extensions.fzf-native;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options.plugins.telescope.extensions.fzf-native = { options.plugins.telescope.extensions.fzf-native = {
enable = mkEnableOption "Enable fzf-native"; enable = mkEnableOption "Enable fzf-native";
package = mkOption { package = helpers.mkPackageOption "telescope extension fzf-native" pkgs.vimPlugins.telescope-fzf-native-nvim;
type = types.package;
default = pkgs.vimPlugins.telescope-fzf-native-nvim;
description = "Plugin to use for telescope extension fzf-native";
};
fuzzy = mkOption { fuzzy = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;

View file

@ -2,16 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.telescope.extensions.media_files; cfg = config.plugins.telescope.extensions.media_files;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options.plugins.telescope.extensions.media_files = { options.plugins.telescope.extensions.media_files = {
enable = mkEnableOption "Enable media_files extension for telescope"; enable = mkEnableOption "Enable media_files extension for telescope";
package = mkOption { package = helpers.mkPackageOption "telescope extension media_files" pkgs.vimPlugins.telescope-media-files-nvim;
type = types.package;
default = pkgs.vimPlugins.telescope-media-files-nvim;
description = "Plugin to use for telescope extension media_files";
};
filetypes = mkOption { filetypes = mkOption {
default = null; default = null;

View file

@ -9,11 +9,7 @@ in
plugins.comment-nvim = { plugins.comment-nvim = {
enable = mkEnableOption "Enable comment-nvim"; enable = mkEnableOption "Enable comment-nvim";
package = mkOption { package = helpers.mkPackageOption "comment-nvim" pkgs.vimPlugins.comment-nvim;
type = types.package;
default = pkgs.vimPlugins.comment-nvim;
description = "Plugin to use for comment-nvim";
};
padding = mkOption { padding = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;

View file

@ -2,6 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.commentary; cfg = config.plugins.commentary;
helpers = import ../helpers.nix { inherit lib; };
in in
{ {
# TODO Add support for aditional filetypes. This requires autocommands! # TODO Add support for aditional filetypes. This requires autocommands!
@ -10,11 +11,7 @@ in
plugins.commentary = { plugins.commentary = {
enable = mkEnableOption "commentary"; enable = mkEnableOption "commentary";
package = mkOption { package = helpers.mkPackageOption "commentary" pkgs.vimPlugins.vim-commentary;
type = types.package;
default = pkgs.vimPlugins.vim-commentary;
description = "Plugin to use for vim-commentary";
};
}; };
}; };

View file

@ -10,11 +10,7 @@ in
plugins.dashboard = { plugins.dashboard = {
enable = mkEnableOption "dashboard"; enable = mkEnableOption "dashboard";
package = mkOption { package = helpers.mkPackageOption "dashboard" pkgs.vimPlugins.dashboard-nvim;
type = types.package;
default = pkgs.vimPlugins.dashboard-nvim;
description = "Plugin to use for dashboard-nvim";
};
header = mkOption { header = mkOption {
description = "Header text"; description = "Header text";

View file

@ -9,11 +9,7 @@ in
plugins.easyescape = { plugins.easyescape = {
enable = mkEnableOption "Enable easyescape"; enable = mkEnableOption "Enable easyescape";
package = mkOption { package = helpers.mkPackageOption "easyescape" pkgs.vimPlugins.vim-easyescape;
type = types.package;
default = pkgs.vimPlugins.vim-easyescape;
description = "Plugin to use for easyescape";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "endwise"; name = "endwise";

View file

@ -9,11 +9,7 @@ in
plugins.floaterm = { plugins.floaterm = {
enable = mkEnableOption "floaterm"; enable = mkEnableOption "floaterm";
package = mkOption { package = helpers.mkPackageOption "floaterm" pkgs.vimPlugins.vim-floaterm;
type = types.package;
default = pkgs.vimPlugins.vim-floaterm;
description = "Plugin to use for floatterm";
};
shell = mkOption { shell = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "goyo"; name = "goyo";

View file

@ -2,6 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.intellitab; cfg = config.plugins.intellitab;
helpers = import ../helpers.nix { inherit lib; };
defs = import ../plugin-defs.nix { inherit pkgs; }; defs = import ../plugin-defs.nix { inherit pkgs; };
in in
{ {
@ -9,11 +10,7 @@ in
plugins.intellitab = { plugins.intellitab = {
enable = mkEnableOption "intellitab.nvim"; enable = mkEnableOption "intellitab.nvim";
package = mkOption { package = helpers.mkPackageOption "intellitab.nvim" defs.intellitab-nvim;
type = types.package;
default = defs.intellitab-nvim;
description = "Plugin to use for intellitab.nvim";
};
}; };
}; };

View file

@ -10,11 +10,7 @@ in
options.plugins.mark-radar = { options.plugins.mark-radar = {
enable = mkEnableOption "mark-radar"; enable = mkEnableOption "mark-radar";
package = mkOption { package = helpers.mkPackageOption "mark-radar" defs.mark-radar;
type = types.package;
default = defs.mark-radar;
description = "Plugin to use for mark-radar";
};
highlight_background = mkOption { highlight_background = mkOption {
type = with types; nullOr bool; type = with types; nullOr bool;

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.notify; cfg = config.plugins.notify;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
icon = mkOption { icon = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
@ -12,11 +12,7 @@ in
options.plugins.notify = { options.plugins.notify = {
enable = mkEnableOption "notify"; enable = mkEnableOption "notify";
package = mkOption { package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify;
type = types.package;
default = pkgs.vimPlugins.nvim-notify;
description = "Plugin to use for notify";
};
stages = mkOption { stages = mkOption {
type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]); type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]);

View file

@ -2,17 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.nvim-autopairs; cfg = config.plugins.nvim-autopairs;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in in
{ {
options.plugins.nvim-autopairs = { options.plugins.nvim-autopairs = {
enable = mkEnableOption "nvim-autopairs"; enable = mkEnableOption "nvim-autopairs";
package = mkOption { package = helpers.mkPackageOption "nvim-autopairs" pkgs.vimPlugins.nvim-autopairs;
type = types.package;
default = pkgs.vimPlugins.nvim-autopairs;
description = "Plugin to use for nvim-autopairs";
};
pairs = mkOption { pairs = mkOption {
type = types.nullOr (types.attrsOf types.str); type = types.nullOr (types.attrsOf types.str);

View file

@ -92,11 +92,7 @@ in
enable = mkEnableOption "nvim-colorizer"; enable = mkEnableOption "nvim-colorizer";
package = mkOption { package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua;
type = types.package;
default = pkgs.vimPlugins.nvim-colorizer-lua;
description = "Plugin to use for vim-commentary";
};
fileTypes = mkOption { fileTypes = mkOption {
description = "Enable and/or configure highlighting for certain filetypes"; description = "Enable and/or configure highlighting for certain filetypes";

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
cfg = config.plugins.nvim-tree; cfg = config.plugins.nvim-tree;
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
optionWarnings = import ../../lib/option-warnings.nix args; optionWarnings = import ../../lib/option-warnings.nix args;
basePluginPath = [ "plugins" "nvim-tree" ]; basePluginPath = [ "plugins" "nvim-tree" ];
in in
@ -21,11 +21,7 @@ in
options.plugins.nvim-tree = { options.plugins.nvim-tree = {
enable = mkEnableOption "nvim-tree"; enable = mkEnableOption "nvim-tree";
package = mkOption { package = helpers.mkPackageOption "nvim-tree" pkgs.vimPlugins.nvim-tree-lua;
type = types.package;
default = pkgs.vimPlugins.nvim-tree-lua;
description = "Plugin to use for nvim-tree";
};
disableNetrw = mkOption { disableNetrw = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;

View file

@ -2,17 +2,13 @@
with lib; with lib;
let let
cfg = config.plugins.project-nvim; cfg = config.plugins.project-nvim;
helpers = import ../helpers.nix { inherit lib; }; helpers = import ../helpers.nix { inherit lib pkgs; };
in in
{ {
options.plugins.project-nvim = helpers.extraOptionsOptions // { options.plugins.project-nvim = helpers.extraOptionsOptions // {
enable = mkEnableOption "project.nvim"; enable = mkEnableOption "project.nvim";
package = mkOption { package = helpers.mkPackageOption "project-nvim" pkgs.vimPlugins.project-nvim;
type = types.package;
default = pkgs.vimPlugins.project-nvim;
description = "Plugin to use for project-nvim";
};
manualMode = mkOption { manualMode = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;

View file

@ -8,11 +8,7 @@ in
options.plugins.specs = { options.plugins.specs = {
enable = mkEnableOption "specs-nvim"; enable = mkEnableOption "specs-nvim";
package = mkOption { package = helpers.mkPackageOption "specs-nvim" pkgs.vimPlugins.specs-nvim;
type = types.package;
default = pkgs.vimPlugins.specs-nvim;
description = "Plugin to use for specs-nvim";
};
show_jumps = mkOption { show_jumps = mkOption {
type = types.bool; type = types.bool;

View file

@ -1,6 +1,6 @@
{ pkgs, lib, ... }@args: { pkgs, lib, ... }@args:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with lib; with helpers; in with lib; with helpers;
mkPlugin args { mkPlugin args {
name = "startify"; name = "startify";

View file

@ -1,6 +1,6 @@
{ lib, pkgs, ... }@attrs: { lib, pkgs, ... }@attrs:
let let
helpers = import ../helpers.nix { lib = lib; }; helpers = import ../helpers.nix { inherit lib; };
in with helpers; with lib; in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "surround"; name = "surround";

View file

@ -9,11 +9,7 @@ in
plugins.undotree = { plugins.undotree = {
enable = mkEnableOption "Enable undotree"; enable = mkEnableOption "Enable undotree";
package = mkOption { package = helpers.mkPackageOption "undotree" pkgs.vimPlugins.undotree;
type = types.package;
default = pkgs.vimPlugins.undotree;
description = "Plugin to use for undotree";
};
windowLayout = mkOption { windowLayout = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;