diff --git a/flake.nix b/flake.nix index 6e4ae51d..98783ffe 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ modules = nixvimModules; }; runUpdates = pkgs.callPackage - ({ pkgs, stdenv }: stdenv.mkDerivation { + ({ pkgs, stdenv }: stdenv.mkDerivation { pname = "run-updates"; version = pkgs.rust-analyzer.version; @@ -67,7 +67,7 @@ nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra nixpkgs-fmt]; buildPhase = '' - extract_rust_analyzer.py editors/code/package.json | + extract_rust_analyzer.py editors/code/package.json | alejandra --quiet | nixpkgs-fmt > rust-analyzer-config.nix ''; diff --git a/lib/helpers.nix b/lib/helpers.nix index a71a3acf..05347234 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -92,6 +92,12 @@ rec { 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 , description , package ? null @@ -112,11 +118,7 @@ rec { options; # does this evaluate package? packageOption = if package == null then { } else { - package = mkOption { - type = types.package; - default = package; - description = "Plugin to use for ${name}"; - }; + package = mkPackageOption name package; }; in { diff --git a/modules/highlights.nix b/modules/highlights.nix index 281cb4fb..1015b263 100644 --- a/modules/highlights.nix +++ b/modules/highlights.nix @@ -1,6 +1,6 @@ { config, lib, ... }: let - helpers = import ../plugins/helpers.nix { inherit lib; }; + helpers = import ../lib/helpers.nix { inherit lib; }; in with lib; { diff --git a/modules/keymaps.nix b/modules/keymaps.nix index b75cf954..c407c3a8 100644 --- a/modules/keymaps.nix +++ b/modules/keymaps.nix @@ -1,7 +1,7 @@ { config, lib, ... }: with lib; let - helpers = import ../plugins/helpers.nix { inherit lib; }; + helpers = import ../lib/helpers.nix { inherit lib; }; mapOption = types.oneOf [ types.str diff --git a/modules/options.nix b/modules/options.nix index d3de54c0..71e5e5d1 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -1,7 +1,7 @@ { config, lib, ... }: with lib; let - helpers = import ../plugins/helpers.nix { inherit lib; }; + helpers = import ../lib/helpers.nix { inherit lib; }; in { options = { diff --git a/plugins/bufferlines/barbar.nix b/plugins/bufferlines/barbar.nix index 7d7e7e48..828c480f 100644 --- a/plugins/bufferlines/barbar.nix +++ b/plugins/bufferlines/barbar.nix @@ -2,16 +2,13 @@ with lib; let cfg = config.plugins.barbar; + helpers = import ../helpers.nix { inherit lib; }; in { options.plugins.barbar = { enable = mkEnableOption "barbar.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.barbar-nvim; - description = "Plugin to use for barbar"; - }; + package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim; animations = mkOption { type = types.nullOr types.bool; diff --git a/plugins/bufferlines/bufferline.nix b/plugins/bufferlines/bufferline.nix index e8371197..090a553c 100644 --- a/plugins/bufferlines/bufferline.nix +++ b/plugins/bufferlines/bufferline.nix @@ -34,11 +34,7 @@ in options = { plugins.bufferline = { enable = mkEnableOption "bufferline"; - package = mkOption { - type = types.package; - description = "Plugin to use for bufferline"; - default = pkgs.vimPlugins.bufferline-nvim; - }; + package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim; numbers = mkOption { type = types.nullOr types.lines; description = "A lua function customizing the styling of numbers."; diff --git a/plugins/colorschemes/base16.nix b/plugins/colorschemes/base16.nix index d7866c11..1a61c4d5 100644 --- a/plugins/colorschemes/base16.nix +++ b/plugins/colorschemes/base16.nix @@ -2,6 +2,7 @@ with lib; let cfg = config.colorschemes.base16; + helpers = import ../helpers.nix { inherit lib; }; themes = import ./base16-list.nix; in { @@ -9,11 +10,7 @@ in colorschemes.base16 = { enable = mkEnableOption "base16"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.base16-vim; - description = "Plugin to use for base16"; - }; + package = helpers.mkPackageOption "base16" pkgs.vimPlugins.base16-vim; useTruecolor = mkOption { type = types.bool; diff --git a/plugins/colorschemes/gruvbox.nix b/plugins/colorschemes/gruvbox.nix index cc591b12..dcc3b590 100644 --- a/plugins/colorschemes/gruvbox.nix +++ b/plugins/colorschemes/gruvbox.nix @@ -2,6 +2,7 @@ with lib; let 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" ]; in { @@ -9,11 +10,7 @@ in colorschemes.gruvbox = { enable = mkEnableOption "gruvbox"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.gruvbox-nvim; - description = "Plugin to use for gruvbox"; - }; + package = helpers.mkPackageOption "gruvbox" pkgs.vimPlugins.gruvbox-nvim; italics = mkEnableOption "italics"; bold = mkEnableOption "bold"; diff --git a/plugins/colorschemes/nord.nix b/plugins/colorschemes/nord.nix index 68926bbd..cc464f72 100644 --- a/plugins/colorschemes/nord.nix +++ b/plugins/colorschemes/nord.nix @@ -2,17 +2,14 @@ with lib; let cfg = config.colorschemes.nord; + helpers = import ../helpers.nix { inherit lib; }; in { options = { colorschemes.nord = { enable = mkEnableOption "nord"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nord-nvim; - description = "Plugin to use for nord.nvim"; - }; + package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim; contrast = mkEnableOption "Make sidebars and popup menus like nvim-tree and telescope have a different background"; diff --git a/plugins/colorschemes/one.nix b/plugins/colorschemes/one.nix index 7ef50559..d4432570 100644 --- a/plugins/colorschemes/one.nix +++ b/plugins/colorschemes/one.nix @@ -2,17 +2,14 @@ with lib; let cfg = config.colorschemes.one; + helpers = import ../helpers.nix { inherit lib; }; in { options = { colorschemes.one = { enable = mkEnableOption "vim-one"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.vim-one; - description = "Plugin to use for one"; - }; + package = helpers.mkPackageOption "one" pkgs.vimPlugins.vim-one; }; }; diff --git a/plugins/colorschemes/onedark.nix b/plugins/colorschemes/onedark.nix index e12ed110..802d0fea 100644 --- a/plugins/colorschemes/onedark.nix +++ b/plugins/colorschemes/onedark.nix @@ -2,17 +2,14 @@ with lib; let cfg = config.colorschemes.onedark; + helpers = import ../helpers.nix { inherit lib; }; in { options = { colorschemes.onedark = { enable = mkEnableOption "onedark"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.onedark-vim; - description = "Plugin to use for one"; - }; + package = helpers.mkPackageOption "one" pkgs.vimPlugins.onedark-vim; }; }; diff --git a/plugins/colorschemes/tokyonight.nix b/plugins/colorschemes/tokyonight.nix index 1cf99d9c..fba4069f 100644 --- a/plugins/colorschemes/tokyonight.nix +++ b/plugins/colorschemes/tokyonight.nix @@ -9,11 +9,7 @@ in options = { colorschemes.tokyonight = { enable = mkEnableOption "tokyonight"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.tokyonight-nvim; - description = "Plugin to use for tokyonight"; - }; + package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim; style = mkOption { type = style; default = "storm"; diff --git a/plugins/completion/copilot.nix b/plugins/completion/copilot.nix index 8a30cb51..84c6c27f 100644 --- a/plugins/completion/copilot.nix +++ b/plugins/completion/copilot.nix @@ -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"; diff --git a/plugins/completion/coq.nix b/plugins/completion/coq.nix index 82be1f98..c0af25b5 100644 --- a/plugins/completion/coq.nix +++ b/plugins/completion/coq.nix @@ -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"; diff --git a/plugins/completion/lspkind.nix b/plugins/completion/lspkind.nix index 3dc4f8fe..e03293c0 100644 --- a/plugins/completion/lspkind.nix +++ b/plugins/completion/lspkind.nix @@ -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" ]); diff --git a/plugins/completion/nvim-cmp/cmp-helpers.nix b/plugins/completion/nvim-cmp/cmp-helpers.nix index ca39a57f..72cc4075 100644 --- a/plugins/completion/nvim-cmp/cmp-helpers.nix +++ b/plugins/completion/nvim-cmp/cmp-helpers.nix @@ -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 { diff --git a/plugins/completion/nvim-cmp/default.nix b/plugins/completion/nvim-cmp/default.nix index 39b0dd48..8812a62e 100644 --- a/plugins/completion/nvim-cmp/default.nix +++ b/plugins/completion/nvim-cmp/default.nix @@ -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; diff --git a/plugins/git/fugitive.nix b/plugins/git/fugitive.nix index 729a7eb2..d3baeb02 100644 --- a/plugins/git/fugitive.nix +++ b/plugins/git/fugitive.nix @@ -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; mkPlugin attrs { name = "fugitive"; diff --git a/plugins/git/gitgutter.nix b/plugins/git/gitgutter.nix index e860230c..81d9ac79 100644 --- a/plugins/git/gitgutter.nix +++ b/plugins/git/gitgutter.nix @@ -9,11 +9,7 @@ in plugins.gitgutter = { enable = mkEnableOption "gitgutter"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.gitgutter; - description = "Plugin to use for gitgutter"; - }; + package = helpers.mkPackageOption "gitgutter" pkgs.vimPlugins.gitgutter; recommendedSettings = mkOption { type = types.bool; diff --git a/plugins/git/gitsigns.nix b/plugins/git/gitsigns.nix index c9447a93..cff50d9b 100644 --- a/plugins/git/gitsigns.nix +++ b/plugins/git/gitsigns.nix @@ -37,11 +37,7 @@ in { options.plugins.gitsigns = { enable = mkEnableOption "Enable gitsigns plugin"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.gitsigns-nvim; - description = "Plugin to use for gitsigns"; - }; + package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim; signs = { add = signOptions { hl = "GitSignsAdd"; diff --git a/plugins/git/neogit.nix b/plugins/git/neogit.nix index af69c42d..3fcccc13 100644 --- a/plugins/git/neogit.nix +++ b/plugins/git/neogit.nix @@ -18,11 +18,7 @@ in plugins.neogit = { enable = mkEnableOption "neogit"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.neogit; - description = "Plugin to use for neogit"; - }; + package = helpers.mkPackageOption "neogit" pkgs.vimPlugins.neogit; disableSigns = mkOption { description = "Disable signs"; diff --git a/plugins/helpers.nix b/plugins/helpers.nix index a6d36262..9d501be8 100644 --- a/plugins/helpers.nix +++ b/plugins/helpers.nix @@ -1,2 +1 @@ args: import ../lib/helpers.nix args - diff --git a/plugins/languages/ledger.nix b/plugins/languages/ledger.nix index d8aa1b07..49a9dda7 100644 --- a/plugins/languages/ledger.nix +++ b/plugins/languages/ledger.nix @@ -1,5 +1,5 @@ { pkgs, lib, ... }@args: -with lib; with import ../helpers.nix { lib = lib; }; +with lib; with import ../helpers.nix { inherit lib; }; mkPlugin args { name = "ledger"; description = "Enable ledger language features"; diff --git a/plugins/languages/nix.nix b/plugins/languages/nix.nix index bc5b9340..d314e330 100644 --- a/plugins/languages/nix.nix +++ b/plugins/languages/nix.nix @@ -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; mkPlugin attrs { name = "nix"; diff --git a/plugins/languages/plantuml-syntax.nix b/plugins/languages/plantuml-syntax.nix index 8083702d..16695d7a 100644 --- a/plugins/languages/plantuml-syntax.nix +++ b/plugins/languages/plantuml-syntax.nix @@ -3,15 +3,14 @@ , config , ... }: -with lib; { +with lib; +let + helpers = import ../helpers.nix { inherit lib; }; +in { options.plugins.plantuml-syntax = { enable = mkEnableOption "plantuml syntax support"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.plantuml-syntax; - description = "Plugin to use for plantuml-syntax"; - }; + package = helpers.mkPackageOption "plantuml-syntax" pkgs.vimPlugins.plantuml-syntax; setMakeprg = mkOption { type = types.bool; diff --git a/plugins/languages/rust.nix b/plugins/languages/rust.nix index 24c49c5a..1abd508d 100644 --- a/plugins/languages/rust.nix +++ b/plugins/languages/rust.nix @@ -1,10 +1,12 @@ { pkgs , config , lib -, helpers , ... }: -with lib; { +with lib; +let + helpers = import ../helpers.nix { inherit lib; }; +in { options.plugins.rust-tools = let mkNullableOptionWithDefault = @@ -46,11 +48,7 @@ with lib; { in { enable = mkEnableOption "rust tools plugins"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.rust-tools-nvim; - description = "Package to use for rust-tools"; - }; + package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim; serverPackage = mkOption { type = types.package; default = pkgs.rust-analyzer; diff --git a/plugins/languages/treesitter-context.nix b/plugins/languages/treesitter-context.nix index 5c1f48e5..44d76db9 100644 --- a/plugins/languages/treesitter-context.nix +++ b/plugins/languages/treesitter-context.nix @@ -3,15 +3,14 @@ , config , ... }: -with lib; { +with lib; +let + helpers = import ../helpers.nix { inherit lib; }; +in { options.plugins.treesitter-context = { enable = mkEnableOption "nvim-treesitter-context"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter-context; - description = "Plugin to use for nvim-treesitter-context"; - }; + package = helpers.mkPackageOption "treesitter-context" pkgs.vimPlugins.nvim-treesitter-context; maxLines = mkOption { type = types.nullOr types.ints.positive; diff --git a/plugins/languages/treesitter-refactor.nix b/plugins/languages/treesitter-refactor.nix index d0791808..a490016d 100644 --- a/plugins/languages/treesitter-refactor.nix +++ b/plugins/languages/treesitter-refactor.nix @@ -3,7 +3,11 @@ , lib , ... }: -with lib; { +with lib; +let + helpers = import ../helpers.nix { inherit lib; }; +in +{ options.plugins.treesitter-refactor = let disable = mkOption { @@ -17,11 +21,7 @@ with lib; { mkEnableOption "treesitter-refactor (requires plugins.treesitter.enable to be true)"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter-refactor; - description = "Plugin to use for treesitter-refactor"; - }; + package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor; highlightDefinitions = { inherit disable; diff --git a/plugins/languages/zig.nix b/plugins/languages/zig.nix index e6353cbf..78958596 100644 --- a/plugins/languages/zig.nix +++ b/plugins/languages/zig.nix @@ -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; mkPlugin attrs { name = "zig"; diff --git a/plugins/nvim-lsp/lsp-lines.nix b/plugins/nvim-lsp/lsp-lines.nix index df06930d..19ef3838 100644 --- a/plugins/nvim-lsp/lsp-lines.nix +++ b/plugins/nvim-lsp/lsp-lines.nix @@ -2,18 +2,14 @@ with lib; let cfg = config.plugins.lsp-lines; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; in { options = { plugins.lsp-lines = { enable = mkEnableOption "lsp_lines.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.lsp_lines-nvim; - description = "Plugin to use for lsp_lines.nvim"; - }; + package = helpers.mkPackageOption "lsp_lines.nvim" pkgs.vimPlugins.lsp_lines-nvim; currentLine = mkOption { type = types.bool; diff --git a/plugins/nvim-lsp/lspsaga.nix b/plugins/nvim-lsp/lspsaga.nix index f5bf6ecf..4f786230 100644 --- a/plugins/nvim-lsp/lspsaga.nix +++ b/plugins/nvim-lsp/lspsaga.nix @@ -2,18 +2,14 @@ with lib; let cfg = config.plugins.lspsaga; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; in { options = { plugins.lspsaga = { enable = mkEnableOption "lspsaga.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.lspsaga-nvim; - description = "Plugin to use for lspsaga.nvim"; - }; + package = helpers.mkPackageOption "lspsaga" pkgs.vimPlugins.lspsaga-nvim; signs = { use = mkOption { diff --git a/plugins/nvim-lsp/nvim-lightbulb.nix b/plugins/nvim-lsp/nvim-lightbulb.nix index 67ec2d08..2426b840 100644 --- a/plugins/nvim-lsp/nvim-lightbulb.nix +++ b/plugins/nvim-lsp/nvim-lightbulb.nix @@ -10,11 +10,7 @@ with lib; { options.plugins.nvim-lightbulb = { enable = mkEnableOption "nvim-lightbulb, showing available code actions"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-lightbulb; - description = "Plugin to use for nvim-lightbulb"; - }; + package = helpers.mkPackageOption "nvim-lightbulb" pkgs.vimPlugins.nvim-lightbulb; ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' LSP client names to ignore diff --git a/plugins/nvim-lsp/trouble.nix b/plugins/nvim-lsp/trouble.nix index d416a0c4..f323f606 100644 --- a/plugins/nvim-lsp/trouble.nix +++ b/plugins/nvim-lsp/trouble.nix @@ -9,11 +9,7 @@ with lib; options.plugins.trouble = { enable = mkEnableOption "trouble.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.trouble-nvim; - description = "Plugin to use for trouble-nvim"; - }; + package = helpers.mkPackageOption "trouble-nvim" pkgs.vimPlugins.trouble-nvim; 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"; diff --git a/plugins/pluginmanagers/packer.nix b/plugins/pluginmanagers/packer.nix index e5f96703..7f05955a 100644 --- a/plugins/pluginmanagers/packer.nix +++ b/plugins/pluginmanagers/packer.nix @@ -2,7 +2,7 @@ with lib; let cfg = config.plugins.packer; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; in { options = { diff --git a/plugins/snippets/luasnip/default.nix b/plugins/snippets/luasnip/default.nix index c8485d0a..24e278d2 100644 --- a/plugins/snippets/luasnip/default.nix +++ b/plugins/snippets/luasnip/default.nix @@ -2,17 +2,13 @@ with lib; let cfg = config.plugins.luasnip; - helpers = import ../../helpers.nix { lib = lib; }; + helpers = import ../../helpers.nix { inherit lib; }; in { options.plugins.luasnip = { enable = mkEnableOption "Enable luasnip"; - package = mkOption { - default = pkgs.vimPlugins.luasnip; - type = types.package; - description = "Plugin to use for luasnip"; - }; + package = helpers.mkPackageOption "luasnip" pkgs.vimPlugins.luasnip; fromVscode = mkOption { default = [ ]; diff --git a/plugins/statuslines/airline.nix b/plugins/statuslines/airline.nix index 56f491d9..6ff4ff87 100644 --- a/plugins/statuslines/airline.nix +++ b/plugins/statuslines/airline.nix @@ -16,11 +16,7 @@ in plugins.airline = { enable = mkEnableOption "airline"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.vim-airline; - description = "Plguin to use for airline"; - }; + package = helpers.mkPackageOption "airline" pkgs.vimPlugins.vim-airline; extensions = mkOption { default = null; diff --git a/plugins/statuslines/lightline.nix b/plugins/statuslines/lightline.nix index 5b53ee1c..290e5abc 100644 --- a/plugins/statuslines/lightline.nix +++ b/plugins/statuslines/lightline.nix @@ -9,11 +9,7 @@ in plugins.lightline = { enable = mkEnableOption "lightline"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.lightline-vim; - description = "Plugin to use for lightline"; - }; + package = helpers.mkPackageOption "lightline" pkgs.vimPlugins.lightline-vim; colorscheme = mkOption { type = with types; nullOr str; diff --git a/plugins/statuslines/lualine.nix b/plugins/statuslines/lualine.nix index 67f23b8d..016c34fb 100644 --- a/plugins/statuslines/lualine.nix +++ b/plugins/statuslines/lualine.nix @@ -2,7 +2,7 @@ with lib; let cfg = config.plugins.lualine; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; separators = mkOption { type = types.nullOr (types.submodule { options = { @@ -58,11 +58,7 @@ in plugins.lualine = { enable = mkEnableOption "lualine"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.lualine-nvim; - description = "Plugin to use for lualine"; - }; + package = helpers.mkPackageOption "lualine" pkgs.vimPlugins.lualine-nvim; theme = mkOption { default = config.colorscheme; diff --git a/plugins/telescope/default.nix b/plugins/telescope/default.nix index e774fe3b..335959a8 100644 --- a/plugins/telescope/default.nix +++ b/plugins/telescope/default.nix @@ -1,8 +1,12 @@ -{ pkgs, config, lib, ... }: +{ pkgs +, config +, lib +, ... +}: with lib; let cfg = config.plugins.telescope; - helpers = (import ../helpers.nix { inherit lib; }); + helpers = import ../helpers.nix { inherit lib; }; in { imports = [ @@ -18,11 +22,7 @@ in options.plugins.telescope = { enable = mkEnableOption "telescope.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.telescope-nvim; - description = "Plugin to use for telescope.nvim"; - }; + package = helpers.mkPackageOption "telescope.nvim" pkgs.vimPlugins.telescope-nvim; highlightTheme = mkOption { type = types.nullOr types.str; diff --git a/plugins/telescope/frecency.nix b/plugins/telescope/frecency.nix index 8d871730..ba3a29e8 100644 --- a/plugins/telescope/frecency.nix +++ b/plugins/telescope/frecency.nix @@ -2,16 +2,13 @@ with lib; let cfg = config.plugins.telescope.extensions.frecency; + helpers = import ../helpers.nix { inherit lib; }; in { options.plugins.telescope.extensions.frecency = { enable = mkEnableOption "frecency"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.telescope-frecency-nvim; - description = "Plugin to use for telescope frecency"; - }; + package = helpers.mkPackageOption "telescope extension frecency" pkgs.vimPlugins.telescope-frecency-nvim; dbRoot = mkOption { type = types.nullOr types.str; diff --git a/plugins/telescope/fzf-native.nix b/plugins/telescope/fzf-native.nix index 525651dc..dd70801b 100644 --- a/plugins/telescope/fzf-native.nix +++ b/plugins/telescope/fzf-native.nix @@ -2,16 +2,13 @@ with lib; let cfg = config.plugins.telescope.extensions.fzf-native; + helpers = import ../helpers.nix { inherit lib; }; in { options.plugins.telescope.extensions.fzf-native = { enable = mkEnableOption "Enable fzf-native"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.telescope-fzf-native-nvim; - description = "Plugin to use for telescope extension fzf-native"; - }; + package = helpers.mkPackageOption "telescope extension fzf-native" pkgs.vimPlugins.telescope-fzf-native-nvim; fuzzy = mkOption { type = types.nullOr types.bool; diff --git a/plugins/telescope/media-files.nix b/plugins/telescope/media-files.nix index df2025d4..20d812ac 100644 --- a/plugins/telescope/media-files.nix +++ b/plugins/telescope/media-files.nix @@ -2,16 +2,13 @@ with lib; let cfg = config.plugins.telescope.extensions.media_files; + helpers = import ../helpers.nix { inherit lib; }; in { options.plugins.telescope.extensions.media_files = { enable = mkEnableOption "Enable media_files extension for telescope"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.telescope-media-files-nvim; - description = "Plugin to use for telescope extension media_files"; - }; + package = helpers.mkPackageOption "telescope extension media_files" pkgs.vimPlugins.telescope-media-files-nvim; filetypes = mkOption { default = null; diff --git a/plugins/utils/comment-nvim.nix b/plugins/utils/comment-nvim.nix index f7c823ed..471f0c7b 100644 --- a/plugins/utils/comment-nvim.nix +++ b/plugins/utils/comment-nvim.nix @@ -9,11 +9,7 @@ in plugins.comment-nvim = { enable = mkEnableOption "Enable comment-nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.comment-nvim; - description = "Plugin to use for comment-nvim"; - }; + package = helpers.mkPackageOption "comment-nvim" pkgs.vimPlugins.comment-nvim; padding = mkOption { type = types.nullOr types.bool; diff --git a/plugins/utils/commentary.nix b/plugins/utils/commentary.nix index cfd428c5..885d81f2 100644 --- a/plugins/utils/commentary.nix +++ b/plugins/utils/commentary.nix @@ -2,6 +2,7 @@ with lib; let cfg = config.plugins.commentary; + helpers = import ../helpers.nix { inherit lib; }; in { # TODO Add support for aditional filetypes. This requires autocommands! @@ -10,11 +11,7 @@ in plugins.commentary = { enable = mkEnableOption "commentary"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.vim-commentary; - description = "Plugin to use for vim-commentary"; - }; + package = helpers.mkPackageOption "commentary" pkgs.vimPlugins.vim-commentary; }; }; diff --git a/plugins/utils/dashboard.nix b/plugins/utils/dashboard.nix index 311d7b93..e47ec62e 100644 --- a/plugins/utils/dashboard.nix +++ b/plugins/utils/dashboard.nix @@ -10,11 +10,7 @@ in plugins.dashboard = { enable = mkEnableOption "dashboard"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.dashboard-nvim; - description = "Plugin to use for dashboard-nvim"; - }; + package = helpers.mkPackageOption "dashboard" pkgs.vimPlugins.dashboard-nvim; header = mkOption { description = "Header text"; diff --git a/plugins/utils/easyescape.nix b/plugins/utils/easyescape.nix index 3c75ebd5..990727de 100644 --- a/plugins/utils/easyescape.nix +++ b/plugins/utils/easyescape.nix @@ -9,11 +9,7 @@ in plugins.easyescape = { enable = mkEnableOption "Enable easyescape"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.vim-easyescape; - description = "Plugin to use for easyescape"; - }; + package = helpers.mkPackageOption "easyescape" pkgs.vimPlugins.vim-easyescape; }; }; config = mkIf cfg.enable { diff --git a/plugins/utils/endwise.nix b/plugins/utils/endwise.nix index 1c5beb9b..e584629d 100644 --- a/plugins/utils/endwise.nix +++ b/plugins/utils/endwise.nix @@ -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; mkPlugin attrs { name = "endwise"; diff --git a/plugins/utils/floaterm.nix b/plugins/utils/floaterm.nix index cc340ce6..3a098676 100644 --- a/plugins/utils/floaterm.nix +++ b/plugins/utils/floaterm.nix @@ -9,11 +9,7 @@ in plugins.floaterm = { enable = mkEnableOption "floaterm"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.vim-floaterm; - description = "Plugin to use for floatterm"; - }; + package = helpers.mkPackageOption "floaterm" pkgs.vimPlugins.vim-floaterm; shell = mkOption { type = types.nullOr types.str; diff --git a/plugins/utils/goyo.nix b/plugins/utils/goyo.nix index 5c0406f2..ac23ab23 100644 --- a/plugins/utils/goyo.nix +++ b/plugins/utils/goyo.nix @@ -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; mkPlugin attrs { name = "goyo"; diff --git a/plugins/utils/intellitab.nix b/plugins/utils/intellitab.nix index 706f9bf8..669f1315 100644 --- a/plugins/utils/intellitab.nix +++ b/plugins/utils/intellitab.nix @@ -2,6 +2,7 @@ with lib; let cfg = config.plugins.intellitab; + helpers = import ../helpers.nix { inherit lib; }; defs = import ../plugin-defs.nix { inherit pkgs; }; in { @@ -9,11 +10,7 @@ in plugins.intellitab = { enable = mkEnableOption "intellitab.nvim"; - package = mkOption { - type = types.package; - default = defs.intellitab-nvim; - description = "Plugin to use for intellitab.nvim"; - }; + package = helpers.mkPackageOption "intellitab.nvim" defs.intellitab-nvim; }; }; diff --git a/plugins/utils/mark-radar.nix b/plugins/utils/mark-radar.nix index deb55ccf..9c1404a2 100644 --- a/plugins/utils/mark-radar.nix +++ b/plugins/utils/mark-radar.nix @@ -10,11 +10,7 @@ in options.plugins.mark-radar = { enable = mkEnableOption "mark-radar"; - package = mkOption { - type = types.package; - default = defs.mark-radar; - description = "Plugin to use for mark-radar"; - }; + package = helpers.mkPackageOption "mark-radar" defs.mark-radar; highlight_background = mkOption { type = with types; nullOr bool; diff --git a/plugins/utils/notify.nix b/plugins/utils/notify.nix index 9bd1a416..73e7cc64 100644 --- a/plugins/utils/notify.nix +++ b/plugins/utils/notify.nix @@ -2,7 +2,7 @@ with lib; let cfg = config.plugins.notify; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; icon = mkOption { type = types.nullOr types.str; default = null; @@ -12,11 +12,7 @@ in options.plugins.notify = { enable = mkEnableOption "notify"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-notify; - description = "Plugin to use for notify"; - }; + package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify; stages = mkOption { type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]); diff --git a/plugins/utils/nvim-autopairs.nix b/plugins/utils/nvim-autopairs.nix index ec330ea1..c392c57d 100644 --- a/plugins/utils/nvim-autopairs.nix +++ b/plugins/utils/nvim-autopairs.nix @@ -2,17 +2,13 @@ with lib; let cfg = config.plugins.nvim-autopairs; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; in { options.plugins.nvim-autopairs = { enable = mkEnableOption "nvim-autopairs"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-autopairs; - description = "Plugin to use for nvim-autopairs"; - }; + package = helpers.mkPackageOption "nvim-autopairs" pkgs.vimPlugins.nvim-autopairs; pairs = mkOption { type = types.nullOr (types.attrsOf types.str); diff --git a/plugins/utils/nvim-colorizer.nix b/plugins/utils/nvim-colorizer.nix index 8c4eaf30..56e5d012 100644 --- a/plugins/utils/nvim-colorizer.nix +++ b/plugins/utils/nvim-colorizer.nix @@ -92,11 +92,7 @@ in enable = mkEnableOption "nvim-colorizer"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-colorizer-lua; - description = "Plugin to use for vim-commentary"; - }; + package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua; fileTypes = mkOption { description = "Enable and/or configure highlighting for certain filetypes"; diff --git a/plugins/utils/nvim-tree.nix b/plugins/utils/nvim-tree.nix index f92800b7..23fd3c0e 100644 --- a/plugins/utils/nvim-tree.nix +++ b/plugins/utils/nvim-tree.nix @@ -2,7 +2,7 @@ with lib; let cfg = config.plugins.nvim-tree; - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; optionWarnings = import ../../lib/option-warnings.nix args; basePluginPath = [ "plugins" "nvim-tree" ]; in @@ -21,11 +21,7 @@ in options.plugins.nvim-tree = { enable = mkEnableOption "nvim-tree"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.nvim-tree-lua; - description = "Plugin to use for nvim-tree"; - }; + package = helpers.mkPackageOption "nvim-tree" pkgs.vimPlugins.nvim-tree-lua; disableNetrw = mkOption { type = types.nullOr types.bool; diff --git a/plugins/utils/project-nvim.nix b/plugins/utils/project-nvim.nix index 14651295..d3d9e759 100644 --- a/plugins/utils/project-nvim.nix +++ b/plugins/utils/project-nvim.nix @@ -2,17 +2,13 @@ with lib; let cfg = config.plugins.project-nvim; - helpers = import ../helpers.nix { inherit lib; }; + helpers = import ../helpers.nix { inherit lib pkgs; }; in { options.plugins.project-nvim = helpers.extraOptionsOptions // { enable = mkEnableOption "project.nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.project-nvim; - description = "Plugin to use for project-nvim"; - }; + package = helpers.mkPackageOption "project-nvim" pkgs.vimPlugins.project-nvim; manualMode = mkOption { type = types.nullOr types.bool; diff --git a/plugins/utils/specs.nix b/plugins/utils/specs.nix index a8808fa9..cd42b8dc 100644 --- a/plugins/utils/specs.nix +++ b/plugins/utils/specs.nix @@ -8,11 +8,7 @@ in options.plugins.specs = { enable = mkEnableOption "specs-nvim"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.specs-nvim; - description = "Plugin to use for specs-nvim"; - }; + package = helpers.mkPackageOption "specs-nvim" pkgs.vimPlugins.specs-nvim; show_jumps = mkOption { type = types.bool; diff --git a/plugins/utils/startify.nix b/plugins/utils/startify.nix index e4d371f6..cac64076 100644 --- a/plugins/utils/startify.nix +++ b/plugins/utils/startify.nix @@ -1,6 +1,6 @@ { pkgs, lib, ... }@args: let - helpers = import ../helpers.nix { lib = lib; }; + helpers = import ../helpers.nix { inherit lib; }; in with lib; with helpers; mkPlugin args { name = "startify"; diff --git a/plugins/utils/surround.nix b/plugins/utils/surround.nix index bf2b7d63..2580c8bc 100644 --- a/plugins/utils/surround.nix +++ b/plugins/utils/surround.nix @@ -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; mkPlugin attrs { name = "surround"; diff --git a/plugins/utils/undotree.nix b/plugins/utils/undotree.nix index 5c74cc4b..223b5a5f 100644 --- a/plugins/utils/undotree.nix +++ b/plugins/utils/undotree.nix @@ -9,11 +9,7 @@ in plugins.undotree = { enable = mkEnableOption "Enable undotree"; - package = mkOption { - type = types.package; - default = pkgs.vimPlugins.undotree; - description = "Plugin to use for undotree"; - }; + package = helpers.mkPackageOption "undotree" pkgs.vimPlugins.undotree; windowLayout = mkOption { type = types.nullOr types.int;