nixvim: support standalone nixvim

This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition.

The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix.

For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
This commit is contained in:
Pedro Alves 2022-09-18 11:19:23 +01:00 committed by GitHub
parent bd6f978d51
commit 4ddd3969e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 1410 additions and 904 deletions

View file

@ -1,10 +1,10 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.barbar;
cfg = config.plugins.barbar;
in
{
options.programs.nixvim.plugins.barbar = {
options.plugins.barbar = {
enable = mkEnableOption "Enable barbar.nvim";
animations = mkOption {
@ -48,7 +48,7 @@ in
# };
};
config.programs.nixvim = mkIf cfg.enable {
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
barbar-nvim nvim-web-devicons
];

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.bufferline;
cfg = config.plugins.bufferline;
helpers = import ../helpers.nix { inherit lib; };
highlight = mkOption {
@ -24,7 +24,7 @@ let
in
{
options = {
programs.nixvim.plugins.bufferline = {
plugins.bufferline = {
enable = mkEnableOption "Enable bufferline";
numbers = mkOption {
type = types.nullOr types.lines;
@ -118,7 +118,7 @@ in
};
showBufferIcons = mkOption {
type = types.nullOr types.bool;
default = null;
default = null;
};
showBufferCloseIcons = mkOption {
type = types.nullOr types.bool;
@ -154,7 +154,7 @@ in
};
highlights = mkOption {
default = null;
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule ({ ... }: {
options = {
fill = highlight;
background = highlight;
@ -221,102 +221,103 @@ in
};
};
config = let
setupOptions = {
options = {
numbers = cfg.numbers;
close_command = cfg.closeCommand;
right_mouse_command = cfg.rightMouseCommand;
left_mouse_command = cfg.leftMouseCommand;
middle_mouse_command = cfg.middleMouseCommand;
indicator_icon = cfg.indicatorIcon;
buffer_close_icon = cfg.bufferCloseIcon;
modified_icon = cfg.modifiedIcon;
close_icon = cfg.closeIcon;
left_trunc_marker = cfg.leftTruncMarker;
right_trunc_marker = cfg.rightTruncMarker;
name_formatter = cfg.nameFormatter;
max_name_length = cfg.maxNameLength;
max_prefix_length = cfg.maxPrefixLength;
tab_size = cfg.tabSize;
diagnostics = cfg.diagnostics;
diagnostics_update_in_insert = cfg.diagnosticsUpdateInInsert;
diagnostics_indicator = cfg.diagnosticsIndicator;
custom_filter = cfg.customFilter;
show_buffer_icons = cfg.showBufferIcons;
show_buffer_close_icons = cfg.showBufferCloseIcons;
show_close_icon = cfg.showCloseIcon;
show_tab_indicators = cfg.showTabIndicators;
persist_buffer_sort = cfg.persistBufferSort;
separator_style = cfg.separatorStyle;
enforce_regular_tabs = cfg.enforceRegularTabs;
always_show_bufferline = cfg.alwaysShowBufferline;
sort_by = cfg.sortBy;
config =
let
setupOptions = {
options = {
numbers = cfg.numbers;
close_command = cfg.closeCommand;
right_mouse_command = cfg.rightMouseCommand;
left_mouse_command = cfg.leftMouseCommand;
middle_mouse_command = cfg.middleMouseCommand;
indicator_icon = cfg.indicatorIcon;
buffer_close_icon = cfg.bufferCloseIcon;
modified_icon = cfg.modifiedIcon;
close_icon = cfg.closeIcon;
left_trunc_marker = cfg.leftTruncMarker;
right_trunc_marker = cfg.rightTruncMarker;
name_formatter = cfg.nameFormatter;
max_name_length = cfg.maxNameLength;
max_prefix_length = cfg.maxPrefixLength;
tab_size = cfg.tabSize;
diagnostics = cfg.diagnostics;
diagnostics_update_in_insert = cfg.diagnosticsUpdateInInsert;
diagnostics_indicator = cfg.diagnosticsIndicator;
custom_filter = cfg.customFilter;
show_buffer_icons = cfg.showBufferIcons;
show_buffer_close_icons = cfg.showBufferCloseIcons;
show_close_icon = cfg.showCloseIcon;
show_tab_indicators = cfg.showTabIndicators;
persist_buffer_sort = cfg.persistBufferSort;
separator_style = cfg.separatorStyle;
enforce_regular_tabs = cfg.enforceRegularTabs;
always_show_bufferline = cfg.alwaysShowBufferline;
sort_by = cfg.sortBy;
};
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
fill = fill;
background = background;
tab = tab;
tab_selected = tabSelected;
tab_close = tabClose;
close_button = closeButton;
close_button_visible = closeButtonVisible;
close_button_selected = closeButtonSelected;
buffer_visible = bufferVisible;
buffer_selected = bufferSelected;
diagnostic = diagnostic;
diagnostic_visible = diagnosticVisible;
diagnostic_selected = diagnosticSelected;
info = info;
info_visible = infoVisible;
info_selected = infoSelected;
info_diagnostic = infoDiagnostic;
info_diagnostic_visible = infoDiagnosticVisible;
info_diagnostic_selected = infoDiagnosticSelected;
warning = warning;
warning_visible = warningVisible;
warning_selected = warningSelected;
warning_diagnostic = warningDiagnostic;
warning_diagnostic_visible = warningDiagnosticVisible;
warning_diagnostic_selected = warningDiagnosticSelected;
error = error;
error_visible = errorVisible;
error_selected = errorSelected;
error_dagnostic = errorDiagnostic;
error_diagnostic_visible = errorDiagnosticVisible;
error_diagnostic_selected = errorDiagnosticSelected;
modified = modified;
modified_visible = modifiedVisible;
modified_selected = modifiedSelected;
duplicate = duplicate;
duplicate_visible = duplicateVisible;
duplicate_selected = duplicateSelected;
separator = separator;
separator_visible = separatorVisible;
separator_selected = separatorSelected;
indicator_selected = indicatorSelected;
pick = pick;
pick_visible = pickVisible;
pick_selected = pickSelected;
};
};
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
fill = fill;
background = background;
tab = tab;
tab_selected = tabSelected;
tab_close = tabClose;
close_button = closeButton;
close_button_visible = closeButtonVisible;
close_button_selected = closeButtonSelected;
buffer_visible = bufferVisible;
buffer_selected = bufferSelected;
diagnostic = diagnostic;
diagnostic_visible = diagnosticVisible;
diagnostic_selected = diagnosticSelected;
info = info;
info_visible = infoVisible;
info_selected = infoSelected;
info_diagnostic = infoDiagnostic;
info_diagnostic_visible = infoDiagnosticVisible;
info_diagnostic_selected = infoDiagnosticSelected;
warning = warning;
warning_visible = warningVisible;
warning_selected = warningSelected;
warning_diagnostic = warningDiagnostic;
warning_diagnostic_visible = warningDiagnosticVisible;
warning_diagnostic_selected = warningDiagnosticSelected;
error = error;
error_visible = errorVisible;
error_selected = errorSelected;
error_dagnostic = errorDiagnostic;
error_diagnostic_visible = errorDiagnosticVisible;
error_diagnostic_selected = errorDiagnosticSelected;
modified = modified;
modified_visible = modifiedVisible;
modified_selected = modifiedSelected;
duplicate = duplicate;
duplicate_visible = duplicateVisible;
duplicate_selected = duplicateSelected;
separator = separator;
separator_visible = separatorVisible;
separator_selected = separatorSelected;
indicator_selected = indicatorSelected;
pick = pick;
pick_visible = pickVisible;
pick_selected = pickSelected;
};
};
in mkIf cfg.enable {
programs.nixvim = {
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
bufferline-nvim
nvim-web-devicons
@ -326,5 +327,4 @@ in
require('bufferline').setup${helpers.toLuaObject setupOptions}
'';
};
};
}

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.base16;
cfg = config.colorschemes.base16;
themes = import ./base16-list.nix;
in {
in
{
options = {
programs.nixvim.colorschemes.base16 = {
colorschemes.base16 = {
enable = mkEnableOption "Enable base16";
useTruecolor = mkOption {
@ -28,14 +29,12 @@ in {
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "base16-${cfg.colorscheme}";
extraPlugins = [ pkgs.vimPlugins.base16-vim ];
colorscheme = "base16-${cfg.colorscheme}";
extraPlugins = [ pkgs.vimPlugins.base16-vim ];
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
plugins.lightline.colorscheme = null;
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
plugins.lightline.colorscheme = null;
options.termguicolors = mkIf cfg.useTruecolor true;
};
options.termguicolors = mkIf cfg.useTruecolor true;
};
}

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.gruvbox;
cfg = config.colorschemes.gruvbox;
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
{
options = {
programs.nixvim.colorschemes.gruvbox = {
colorschemes.gruvbox = {
enable = mkEnableOption "Enable gruvbox";
italics = mkEnableOption "Enable italics";
@ -111,33 +112,31 @@ in {
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "gruvbox";
extraPlugins = [ pkgs.vimPlugins.gruvbox-nvim ];
colorscheme = "gruvbox";
extraPlugins = [ pkgs.vimPlugins.gruvbox-nvim ];
globals = {
gruvbox_bold = mkIf (!cfg.bold) 0;
gruvbox_italic = mkIf (cfg.italics) 1;
gruvbox_underline = mkIf (cfg.underline) 1;
gruvbox_undercurl = mkIf (cfg.undercurl) 1;
gruvbox_transparent_bg = mkIf (cfg.transparentBg) 0;
gruvbox_contrast_dark = mkIf (!isNull cfg.contrastDark) cfg.contrastDark;
gruvbox_contrast_light = mkIf (!isNull cfg.contrastLight) cfg.contrastLight;
gruvbox_hls_cursor = mkIf (!isNull cfg.highlightSearchCursor) cfg.highlightSearchCursor;
gruvbox_number_column = mkIf (!isNull cfg.numberColumn) cfg.numberColumn;
gruvbox_sign_column = mkIf (!isNull cfg.signColumn) cfg.signColumn;
gruvbox_color_column = mkIf (!isNull cfg.colorColumn) cfg.colorColumn;
gruvbox_vert_split = mkIf (!isNull cfg.vertSplitColor) cfg.vertSplitColor;
globals = {
gruvbox_bold = mkIf (!cfg.bold) 0;
gruvbox_italic = mkIf (cfg.italics) 1;
gruvbox_underline = mkIf (cfg.underline) 1;
gruvbox_undercurl = mkIf (cfg.undercurl) 1;
gruvbox_transparent_bg = mkIf (cfg.transparentBg) 0;
gruvbox_contrast_dark = mkIf (!isNull cfg.contrastDark) cfg.contrastDark;
gruvbox_contrast_light = mkIf (!isNull cfg.contrastLight) cfg.contrastLight;
gruvbox_hls_cursor = mkIf (!isNull cfg.highlightSearchCursor) cfg.highlightSearchCursor;
gruvbox_number_column = mkIf (!isNull cfg.numberColumn) cfg.numberColumn;
gruvbox_sign_column = mkIf (!isNull cfg.signColumn) cfg.signColumn;
gruvbox_color_column = mkIf (!isNull cfg.colorColumn) cfg.colorColumn;
gruvbox_vert_split = mkIf (!isNull cfg.vertSplitColor) cfg.vertSplitColor;
gruvbox_italicize_comments = mkIf (!cfg.italicizeComments) 0;
gruvbox_italicize_strings = mkIf (cfg.italicizeStrings) 1;
gruvbox_invert_selection = mkIf (!cfg.invertSelection) 0;
gruvbox_invert_signs = mkIf (cfg.invertSigns) 1;
gruvbox_invert_indent_guides = mkIf (cfg.invertIndentGuides) 1;
gruvbox_invert_tabline = mkIf (cfg.invertTabline) 1;
gruvbox_improved_strings = mkIf (cfg.improvedStrings) 1;
gruvbox_improved_warnings = mkIf (cfg.improvedWarnings) 1;
};
gruvbox_italicize_comments = mkIf (!cfg.italicizeComments) 0;
gruvbox_italicize_strings = mkIf (cfg.italicizeStrings) 1;
gruvbox_invert_selection = mkIf (!cfg.invertSelection) 0;
gruvbox_invert_signs = mkIf (cfg.invertSigns) 1;
gruvbox_invert_indent_guides = mkIf (cfg.invertIndentGuides) 1;
gruvbox_invert_tabline = mkIf (cfg.invertTabline) 1;
gruvbox_improved_strings = mkIf (cfg.improvedStrings) 1;
gruvbox_improved_warnings = mkIf (cfg.improvedWarnings) 1;
};
};
}

View file

@ -1,11 +1,11 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.nord;
let
cfg = config.colorschemes.nord;
in
{
options = {
programs.nixvim.colorschemes.nord = {
colorschemes.nord = {
enable = mkEnableOption "Enable nord";
contrast = mkEnableOption
@ -32,18 +32,16 @@ in
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "nord";
extraPlugins = [ pkgs.vimPlugins.nord-nvim ];
colorscheme = "nord";
extraPlugins = [ pkgs.vimPlugins.nord-nvim ];
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;
};
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;
};
};
}

View file

@ -1,22 +1,21 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.one;
in {
cfg = config.colorschemes.one;
in
{
options = {
programs.nixvim.colorschemes.one = {
colorschemes.one = {
enable = mkEnableOption "Enable vim-one";
};
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "one";
extraPlugins = [ pkgs.vimPlugins.vim-one ];
colorscheme = "one";
extraPlugins = [ pkgs.vimPlugins.vim-one ];
options = {
termguicolors = true;
};
options = {
termguicolors = true;
};
};
}

View file

@ -1,22 +1,21 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.onedark;
in {
cfg = config.colorschemes.onedark;
in
{
options = {
programs.nixvim.colorschemes.onedark = {
colorschemes.onedark = {
enable = mkEnableOption "Enable onedark";
};
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "onedark";
extraPlugins = [ pkgs.vimPlugins.onedark-vim ];
colorscheme = "onedark";
extraPlugins = [ pkgs.vimPlugins.onedark-vim ];
options = {
termguicolors = true;
};
options = {
termguicolors = true;
};
};
}

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.colorschemes.tokyonight;
cfg = config.colorschemes.tokyonight;
style = types.enum [ "storm" "night" "day" ];
in {
in
{
options = {
programs.nixvim.colorschemes.tokyonight = {
colorschemes.tokyonight = {
enable = mkEnableOption "Enable tokyonight";
style = mkOption {
type = types.nullOr style;
@ -33,27 +34,25 @@ in {
};
};
config = mkIf cfg.enable {
programs.nixvim = {
colorscheme = "tokyonight";
extraPlugins = [ pkgs.vimPlugins.tokyonight-nvim ];
options = { termguicolors = true; };
globals = {
tokyonight_style = mkIf (!isNull cfg.style) cfg.style;
tokyonight_terminal_colors = mkIf (!cfg.terminalColors) 0;
colorscheme = "tokyonight";
extraPlugins = [ pkgs.vimPlugins.tokyonight-nvim ];
options = { termguicolors = true; };
globals = {
tokyonight_style = mkIf (!isNull cfg.style) cfg.style;
tokyonight_terminal_colors = mkIf (!cfg.terminalColors) 0;
tokyonight_italic_comments = mkIf (!cfg.italicComments) 0;
tokyonight_italic_keywords = mkIf (!cfg.italicKeywords) 0;
tokyonight_italic_functions = mkIf (cfg.italicFunctions) 1;
tokyonight_italic_variables = mkIf (cfg.italicVariables) 1;
tokyonight_italic_comments = mkIf (!cfg.italicComments) 0;
tokyonight_italic_keywords = mkIf (!cfg.italicKeywords) 0;
tokyonight_italic_functions = mkIf (cfg.italicFunctions) 1;
tokyonight_italic_variables = mkIf (cfg.italicVariables) 1;
tokyonight_transparent = mkIf (cfg.transparent) 1;
tokyonight_hide_inactive_statusline =
mkIf (cfg.hideInactiveStatusline) 1;
tokyonight_transparent_sidebar = mkIf (cfg.transparentSidebar) 1;
tokyonight_dark_sidebar = mkIf (!cfg.darkSidebar) 0;
tokyonight_dark_float = mkIf (!cfg.darkFloat) 0;
tokyonight_lualine_bold = mkIf (cfg.lualineBold) 1;
};
tokyonight_transparent = mkIf (cfg.transparent) 1;
tokyonight_hide_inactive_statusline =
mkIf (cfg.hideInactiveStatusline) 1;
tokyonight_transparent_sidebar = mkIf (cfg.transparentSidebar) 1;
tokyonight_dark_sidebar = mkIf (!cfg.darkSidebar) 0;
tokyonight_dark_float = mkIf (!cfg.darkFloat) 0;
tokyonight_lualine_bold = mkIf (cfg.lualineBold) 1;
};
};
}

View file

@ -1,19 +1,20 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.coq-nvim;
cfg = config.plugins.coq-nvim;
helpers = import ../helpers.nix { lib = lib; };
plugins = import ../plugin-defs.nix { inherit pkgs; };
in {
in
{
options = {
programs.nixvim.plugins.coq-nvim = {
plugins.coq-nvim = {
enable = mkEnableOption "Enable coq-nvim";
installArtifacts = mkEnableOption "Install coq-artifacts";
autoStart = mkOption {
type = with types; nullOr (oneOf [bool (enum ["shut-up"])]);
type = with types; nullOr (oneOf [ bool (enum [ "shut-up" ]) ]);
default = null;
description = "Auto-start or shut up";
};
@ -25,13 +26,14 @@ in {
};
};
};
config = let
settings = {
auto_start = cfg.autoStart;
"keymap.recommended" = cfg.recommendedKeymaps;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
settings = {
auto_start = cfg.autoStart;
"keymap.recommended" = cfg.recommendedKeymaps;
};
in
mkIf cfg.enable {
extraPlugins = [
plugins.coq-nvim
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
@ -40,8 +42,7 @@ in {
vim.g.coq_settings = ${helpers.toLuaObject settings}
local coq = require 'coq'
'';
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
};
};
};
}

View file

@ -1,7 +1,7 @@
{ pkgs, config, lib, ... }@args:
with lib;
let
cfg = config.programs.nixvim.plugins.nvim-cmp;
cfg = config.plugins.nvim-cmp;
helpers = import ../../helpers.nix { lib = lib; };
mkNullOrOption = helpers.mkNullOrOption;
cmpLib = import ./cmp-helpers.nix args;
@ -14,7 +14,7 @@ let
''${functionName}(${parameterString})'';
in
{
options.programs.nixvim.plugins.nvim-cmp = {
options.plugins.nvim-cmp = {
enable = mkEnableOption "Enable nvim-cmp";
performance = mkOption {
@ -392,32 +392,30 @@ in
};
in
mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [ pkgs.vimPlugins.nvim-cmp ];
extraPlugins = [ pkgs.vimPlugins.nvim-cmp ];
extraConfigLua = ''
local cmp = require('cmp')
cmp.setup(${helpers.toLuaObject options})
'';
extraConfigLua = ''
local cmp = require('cmp')
cmp.setup(${helpers.toLuaObject options})
'';
# If auto_enable_sources is set to true, figure out which are provided by the user
# and enable the corresponding plugins.
plugins =
let
flattened_sources = if (isNull cfg.sources) then [ ] else flatten cfg.sources;
# Take only the names from the sources provided by the user
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
# A list of known source names
known_source_names = attrNames cmpLib.pluginAndSourceNames;
# If auto_enable_sources is set to true, figure out which are provided by the user
# and enable the corresponding plugins.
plugins =
let
flattened_sources = if (isNull cfg.sources) then [ ] else flatten cfg.sources;
# Take only the names from the sources provided by the user
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
# A list of known source names
known_source_names = attrNames cmpLib.pluginAndSourceNames;
attrs_enabled = listToAttrs (map
(name: {
name = cmpLib.pluginAndSourceNames.${name};
value.enable = mkIf (elem name found_sources) true;
})
known_source_names);
in
mkIf cfg.auto_enable_sources attrs_enabled;
};
attrs_enabled = listToAttrs (map
(name: {
name = cmpLib.pluginAndSourceNames.${name};
value.enable = mkIf (elem name found_sources) true;
})
known_source_names);
in
mkIf cfg.auto_enable_sources attrs_enabled;
};
}

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.gitgutter;
cfg = config.plugins.gitgutter;
helpers = import ../helpers.nix { inherit lib; };
in {
in
{
options = {
programs.nixvim.plugins.gitgutter = {
plugins.gitgutter = {
enable = mkEnableOption "Enable gitgutter";
recommendedSettings = mkOption {
@ -51,24 +52,26 @@ in {
};
signs = mkOption {
type = let
signOption = desc: mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
type =
let
signOption = desc: mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
};
in
types.submodule {
options = {
added = signOption "added lines";
modified = signOption "modified lines";
removed = signOption "removed lines";
modifiedAbove = signOption "modified line above";
removedFirstLine = signOption "a removed first line";
removedAboveAndBelow = signOption "lines removed above and below";
modifiedRemoved = signOption "modified and removed lines";
};
};
in types.submodule {
options = {
added = signOption "added lines";
modified = signOption "modified lines";
removed = signOption "removed lines";
modifiedAbove = signOption "modified line above";
removedFirstLine = signOption "a removed first line";
removedAboveAndBelow = signOption "lines removed above and below";
modifiedRemoved = signOption "modified and removed lines";
};
};
default = {};
default = { };
description = "Custom signs for the sign column";
};
@ -91,19 +94,22 @@ in {
};
grep = mkOption {
type = types.nullOr (types.oneOf [ (types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
type = types.nullOr (types.oneOf [
(types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
};
};
};
}) types.str]);
})
types.str
]);
default = null;
description = "A non-standard grep to use instead of the default";
};
@ -158,11 +164,12 @@ in {
};
};
config = let
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [];
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
in mkIf cfg.enable {
programs.nixvim = {
config =
let
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.gitgutter ];
options = mkIf cfg.recommendedSettings {
@ -205,5 +212,4 @@ in {
gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0;
};
};
};
}

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.neogit;
cfg = config.plugins.neogit;
helpers = import ../helpers.nix { inherit lib; };
sectionDefaultsModule = types.submodule {
@ -15,7 +15,7 @@ let
in
{
options = {
programs.nixvim.plugins.neogit = {
plugins.neogit = {
enable = mkEnableOption "Enable neogit";
disableSigns = mkOption {
@ -201,20 +201,21 @@ in
};
};
config = let
setupOptions = with cfg; helpers.toLuaObject {
inherit kind integrations signs sections mappings;
disable_signs = disableSigns;
disable_hint = disableHint;
disable_context_highlighting = disableContextHighlighting;
disable_commit_confirmation = disableCommitConfirmation;
auto_refresh = autoRefresh;
disable_builtin_notifications = disableBuiltinNotifications;
use_magit_keybindings = useMagitKeybindings;
commit_popup = commitPopup;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
setupOptions = with cfg; helpers.toLuaObject {
inherit kind integrations signs sections mappings;
disable_signs = disableSigns;
disable_hint = disableHint;
disable_context_highlighting = disableContextHighlighting;
disable_commit_confirmation = disableCommitConfirmation;
auto_refresh = autoRefresh;
disable_builtin_notifications = disableBuiltinNotifications;
use_magit_keybindings = useMagitKeybindings;
commit_popup = commitPopup;
};
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
neogit
plenary-nvim
@ -224,5 +225,4 @@ in
require('neogit').setup(${setupOptions})
'';
};
};
}

View file

@ -71,7 +71,7 @@ rec {
options ? {},
...
}: let
cfg = config.programs.nixvim.plugins.${name};
cfg = config.plugins.${name};
# TODO support nested options!
pluginOptions = mapAttrs (k: v: v.option) options;
globals = mapAttrs' (name: opt: {
@ -79,11 +79,11 @@ rec {
value = if cfg.${name} != null then opt.value cfg.${name} else null;
}) options;
in {
options.programs.nixvim.plugins.${name} = {
options.plugins.${name} = {
enable = mkEnableOption description;
} // pluginOptions;
config.programs.nixvim = mkIf cfg.enable {
config = mkIf cfg.enable {
inherit extraPlugins globals;
};
};

View file

@ -1,19 +1,20 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.treesitter;
cfg = config.plugins.treesitter;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
programs.nixvim.plugins.treesitter = {
plugins.treesitter = {
enable = mkEnableOption "Enable tree-sitter syntax highlighting";
nixGrammars = mkOption {
type = types.bool;
default = false;
description = "Install grammars with Nix (beta)";
default = true;
description = "Install grammars with Nix";
};
ensureInstalled = mkOption {
type = with types; oneOf [ (enum [ "all" ]) (listOf str) ];
default = "all";
@ -92,20 +93,18 @@ in
};
in
mkIf cfg.enable {
programs.nixvim = {
extraConfigLua = ''
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
'';
extraConfigLua = ''
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
'';
extraPlugins = with pkgs; if cfg.nixGrammars then
[ (vimPlugins.nvim-treesitter.withPlugins (_: tree-sitter.allGrammars)) ]
else [ vimPlugins.nvim-treesitter ];
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
extraPlugins = with pkgs; if cfg.nixGrammars then
[ (vimPlugins.nvim-treesitter.withPlugins (_: tree-sitter.allGrammars)) ]
else [ vimPlugins.nvim-treesitter ];
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
options = mkIf cfg.folding {
foldmethod = "expr";
foldexpr = "nvim_treesitter#foldexpr()";
};
options = mkIf cfg.folding {
foldmethod = "expr";
foldexpr = "nvim_treesitter#foldexpr()";
};
};
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.null-ls;
cfg = config.plugins.null-ls;
helpers = (import ../helpers.nix { inherit lib; });
in
{
@ -9,7 +9,7 @@ in
./servers.nix
];
options.programs.nixvim.plugins.null-ls = {
options.plugins.null-ls = {
enable = mkEnableOption "Enable null-ls";
debug = mkOption {
@ -30,18 +30,18 @@ in
# };
};
config = let
options = {
debug = cfg.debug;
sources = cfg.sourcesItems;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
options = {
debug = cfg.debug;
sources = cfg.sourcesItems;
};
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ null-ls-nvim ];
extraConfigLua = ''
require("null-ls").setup(${helpers.toLuaObject options})
'';
};
};
}

View file

@ -1,46 +1,46 @@
{ pkgs, config, lib, ... }:
{
mkServer = {
name,
sourceType,
description ? "Enable ${name} source, for null-ls.",
packages ? [],
... }:
# returns a module
{ pkgs, config, lib, ... }@args:
with lib;
let
helpers = import ../helpers.nix args;
cfg = config.programs.nixvim.plugins.null-ls.sources.${sourceType}.${name};
in
{
options.programs.nixvim.plugins.null-ls.sources.${sourceType}.${name} = {
enable = mkEnableOption description;
mkServer =
{ name
, sourceType
, description ? "Enable ${name} source, for null-ls."
, packages ? [ ]
, ...
}:
# returns a module
{ pkgs, config, lib, ... }@args:
with lib;
let
helpers = import ../helpers.nix args;
cfg = config.plugins.null-ls.sources.${sourceType}.${name};
in
{
options.plugins.null-ls.sources.${sourceType}.${name} = {
enable = mkEnableOption description;
# TODO: withArgs can exist outside of the module in a generalized manner
withArgs = mkOption {
default = null;
type = with types; nullOr str;
description = ''Raw Lua code to be called with the with function'';
# Not sure that it makes sense to have the same example for all servers
# example = ''
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
# '';
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPackages = packages;
# Add source to list of sources
plugins.null-ls.sourcesItems = let
sourceItem = "${sourceType}.${name}";
withArgs = if (isNull cfg.withArgs) then sourceItem else "${sourceItem}.with ${cfg.withArgs}";
finalString = ''require("null-ls").builtins.${withArgs}'';
in [ (helpers.mkRaw finalString) ];
};
# TODO: withArgs can exist outside of the module in a generalized manner
withArgs = mkOption {
default = null;
type = with types; nullOr str;
description = ''Raw Lua code to be called with the with function'';
# Not sure that it makes sense to have the same example for all servers
# example = ''
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
# '';
};
};
config = mkIf cfg.enable {
extraPackages = packages;
# Add source to list of sources
plugins.null-ls.sourcesItems =
let
sourceItem = "${sourceType}.${name}";
withArgs = if (isNull cfg.withArgs) then sourceItem else "${sourceItem}.with ${cfg.withArgs}";
finalString = ''require("null-ls").builtins.${withArgs}'';
in
[ (helpers.mkRaw finalString) ];
};
};
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lsp;
cfg = config.plugins.lsp;
helpers = (import ../helpers.nix { inherit lib; });
in
{
@ -10,25 +10,28 @@ in
];
options = {
programs.nixvim.plugins.lsp = {
plugins.lsp = {
enable = mkEnableOption "Enable neovim's built-in LSP";
enabledServers = mkOption {
type = with types; listOf (oneOf [str (submodule {
options = {
name = mkOption {
type = str;
description = "The server's name";
};
type = with types; listOf (oneOf [
str
(submodule {
options = {
name = mkOption {
type = str;
description = "The server's name";
};
extraOptions = mkOption {
type = attrs;
description = "Extra options for the server";
extraOptions = mkOption {
type = attrs;
description = "Extra options for the server";
};
};
};
})]);
})
]);
description = "A list of enabled LSP servers. Don't use this directly.";
default = [];
default = [ ];
};
onAttach = mkOption {
@ -40,7 +43,7 @@ in
setupWrappers = mkOption {
type = with types; listOf (functionTo str);
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
default = [];
default = [ ];
};
preConfig = mkOption {
@ -51,12 +54,13 @@ in
};
};
config = let
runWrappers = wrappers: s:
if wrappers == [] then s
else (head wrappers) (runWrappers (tail wrappers) s);
in mkIf cfg.enable {
programs.nixvim = {
config =
let
runWrappers = wrappers: s:
if wrappers == [ ] then s
else (head wrappers) (runWrappers (tail wrappers) s);
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-lspconfig ];
# Enable all LSP servers
@ -85,5 +89,4 @@ in
-- }}}
'';
};
};
}

View file

@ -1,29 +1,30 @@
{ pkgs, config, lib, ... }:
{
mkLsp = {
name,
description ? "Enable ${name}.",
serverName ? name,
packages ? [ pkgs.${name} ],
... }:
# returns a module
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lsp.servers.${name};
in
{
options = {
programs.nixvim.plugins.lsp.servers.${name} = {
enable = mkEnableOption description;
};
};
config = mkIf cfg.enable {
programs.nixvim.extraPackages = packages;
programs.nixvim.plugins.lsp.enabledServers = [ serverName ];
mkLsp =
{ name
, description ? "Enable ${name}."
, serverName ? name
, packages ? [ pkgs.${name} ]
, ...
}:
# returns a module
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.plugins.lsp.servers.${name};
in
{
options = {
plugins.lsp.servers.${name} = {
enable = mkEnableOption description;
};
};
config = mkIf cfg.enable {
extraPackages = packages;
plugins.lsp.enabledServers = [ serverName ];
};
};
}

View file

@ -1,17 +1,17 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lsp-lines;
cfg = config.plugins.lsp-lines;
helpers = import ../helpers.nix { lib = lib; };
in
{
options = {
programs.nixvim.plugins.lsp-lines = {
plugins.lsp-lines = {
enable = mkEnableOption "lsp_lines.nvim";
};
};
config.programs.nixvim =
config =
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ];

View file

@ -1,12 +1,12 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lspsaga;
cfg = config.plugins.lspsaga;
helpers = import ../helpers.nix { lib = lib; };
in
{
options = {
programs.nixvim.plugins.lspsaga = {
plugins.lspsaga = {
enable = mkEnableOption "Enable lspsava.nvim";
signs = {
@ -141,7 +141,7 @@ in
};
};
config.programs.nixvim = let
config = let
notDefault = default: opt: if (opt != default) then opt else null;
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != {}) then opt else null;
notNull = opt: opt;

View file

@ -1,74 +1,82 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.packer;
cfg = config.plugins.packer;
helpers = import ../helpers.nix { lib = lib; };
in {
in
{
options = {
programs.nixvim.plugins.packer = {
plugins.packer = {
enable = mkEnableOption "Enable packer.nvim";
plugins = mkOption {
type = types.listOf (types.oneOf [types.str (with types; let
mkOpt = type: desc: mkOption {
type = nullOr type;
default = null;
description = desc;
};
function = attrsOf str;
in types.submodule {
options = {
name = mkOption {
type = str;
description = "Name of the plugin to install";
type = types.listOf (types.oneOf [
types.str
(with types; let
mkOpt = type: desc: mkOption {
type = nullOr type;
default = null;
description = desc;
};
function = attrsOf str;
in
types.submodule {
options = {
name = mkOption {
type = str;
description = "Name of the plugin to install";
};
disable = mkOpt bool "Mark plugin as inactive";
as = mkOpt bool "Specifies an alias under which to install the plugin";
installer = mkOpt function "A custom installer";
updater = mkOpt function "A custom updater";
after = mkOpt (oneOf [str (listOf any)]) "Plugins to load after this plugin";
rtp = mkOpt str "Specifies a subdirectory of the plugin to add to runtimepath";
opt = mkOpt str "Marks a plugin as optional";
branch = mkOpt str "Git branch to use";
tag = mkOpt str "Git tag to use";
commit = mkOpt str "Git commit to use";
lock = mkOpt bool "Skip this plugin in updates";
run = mkOpt (oneOf [str function]) "Post-install hook";
requires = mkOpt (oneOf [str (listOf any)]) "Plugin dependencies";
rocks = mkOpt (oneOf [str (listOf any)]) "Luarocks dependencies";
config = mkOpt (oneOf [str function]) "Code to run after this plugin is loaded";
setup = mkOpt (oneOf [str function]) "Code to be run before this plugin is loaded";
cmd = mkOpt (oneOf [str (listOf str)]) "Commands which load this plugin";
ft = mkOpt (oneOf [str (listOf str)]) "Filetypes which load this plugin";
keys = mkOpt (oneOf [str (listOf str)]) "Keymaps which load this plugin";
event = mkOpt (oneOf [str (listOf str)]) "Autocommand events which load this plugin";
fn = mkOpt (oneOf [str (listOf str)]) "Functions which load this plugin";
cond = mkOpt (oneOf [str function (listOf (oneOf [str function]))]) "Conditional test to load this plugin";
module = mkOpt (oneOf [str (listOf str)]) "Patterns of module names which load this plugin";
};
})]);
default = [];
disable = mkOpt bool "Mark plugin as inactive";
as = mkOpt bool "Specifies an alias under which to install the plugin";
installer = mkOpt function "A custom installer";
updater = mkOpt function "A custom updater";
after = mkOpt (oneOf [ str (listOf any) ]) "Plugins to load after this plugin";
rtp = mkOpt str "Specifies a subdirectory of the plugin to add to runtimepath";
opt = mkOpt str "Marks a plugin as optional";
branch = mkOpt str "Git branch to use";
tag = mkOpt str "Git tag to use";
commit = mkOpt str "Git commit to use";
lock = mkOpt bool "Skip this plugin in updates";
run = mkOpt (oneOf [ str function ]) "Post-install hook";
requires = mkOpt (oneOf [ str (listOf any) ]) "Plugin dependencies";
rocks = mkOpt (oneOf [ str (listOf any) ]) "Luarocks dependencies";
config = mkOpt (oneOf [ str function ]) "Code to run after this plugin is loaded";
setup = mkOpt (oneOf [ str function ]) "Code to be run before this plugin is loaded";
cmd = mkOpt (oneOf [ str (listOf str) ]) "Commands which load this plugin";
ft = mkOpt (oneOf [ str (listOf str) ]) "Filetypes which load this plugin";
keys = mkOpt (oneOf [ str (listOf str) ]) "Keymaps which load this plugin";
event = mkOpt (oneOf [ str (listOf str) ]) "Autocommand events which load this plugin";
fn = mkOpt (oneOf [ str (listOf str) ]) "Functions which load this plugin";
cond = mkOpt (oneOf [ str function (listOf (oneOf [ str function ])) ]) "Conditional test to load this plugin";
module = mkOpt (oneOf [ str (listOf str) ]) "Patterns of module names which load this plugin";
};
})
]);
default = [ ];
description = "List of plugins";
};
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [ (pkgs.vimPlugins.packer-nvim.overrideAttrs (_: { pname = "packer.nvim"; })) ];
extraPackages = [ pkgs.git ];
extraPlugins = [ (pkgs.vimPlugins.packer-nvim.overrideAttrs (_: { pname = "packer.nvim"; })) ];
extraPackages = [ pkgs.git ];
extraConfigLua = let
plugins = map (plugin: if isAttrs plugin then
mapAttrs' (k: v: { name = if k == "name" then "@" else k; value = v; }) plugin
else plugin) cfg.plugins;
extraConfigLua =
let
plugins = map
(plugin:
if isAttrs plugin then
mapAttrs' (k: v: { name = if k == "name" then "@" else k; value = v; }) plugin
else plugin)
cfg.plugins;
packedPlugins = if length plugins == 1 then head plugins else plugins;
in mkIf (cfg.plugins != []) ''
in
mkIf (cfg.plugins != [ ]) ''
require('packer').startup(function()
use ${helpers.toLuaObject packedPlugins}
end)
'';
};
};
}

View file

@ -1,18 +1,19 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.airline;
cfg = config.plugins.airline;
helpers = import ../helpers.nix { inherit lib; };
sectionType = with types; nullOr (oneOf [ str (listOf str)]);
sectionType = with types; nullOr (oneOf [ str (listOf str) ]);
sectionOption = mkOption {
default = null;
type = sectionType;
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
};
in {
in
{
options = {
programs.nixvim.plugins.airline = {
plugins.airline = {
enable = mkEnableOption "Enable airline";
extensions = mkOption {
@ -49,17 +50,18 @@ in {
};
theme = mkOption {
default = config.programs.nixvim.colorscheme;
default = config.colorscheme;
type = with types; nullOr str;
description = "The theme to use for vim-airline. If set, vim-airline-themes will be installed.";
};
};
};
config = let
sections = {};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
sections = { };
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
vim-airline
] ++ optional (!isNull cfg.theme) vim-airline-themes;
@ -72,5 +74,4 @@ in {
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
} // sections;
};
};
}

View file

@ -1,16 +1,17 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lightline;
cfg = config.plugins.lightline;
helpers = import ../helpers.nix { inherit lib; };
in {
in
{
options = {
programs.nixvim.plugins.lightline = {
plugins.lightline = {
enable = mkEnableOption "Enable lightline";
colorscheme = mkOption {
type = with types; nullOr str;
default = config.programs.nixvim.colorscheme;
default = config.colorscheme;
description = "The colorscheme to use for lightline. Defaults to .colorscheme.";
example = "gruvbox";
};
@ -24,7 +25,7 @@ in {
You should define the functions themselves in extraConfig
'';
example = ''
programs.nixvim.plugins.lightline = {
plugins.lightline = {
enable = true;
componentFunction = {
readonly = "LightlineReadonly";
@ -48,21 +49,23 @@ in {
active = mkOption {
default = null;
type = types.nullOr (types.submodule {
options = let
listType = with types; nullOr (listOf (listOf str));
in {
left = mkOption {
type = listType;
description = "List of components that will show up on the left side of the bar";
default = null;
};
options =
let
listType = with types; nullOr (listOf (listOf str));
in
{
left = mkOption {
type = listType;
description = "List of components that will show up on the left side of the bar";
default = null;
};
right = mkOption {
type = listType;
description = "List of components that will show up on the right side of the bar";
default = null;
right = mkOption {
type = listType;
description = "List of components that will show up on the right side of the bar";
default = null;
};
};
};
});
};
@ -74,14 +77,14 @@ in {
};
};
config = let
configAttrs = filterAttrs (_: v: v != null) {
inherit (cfg) colorscheme active component componentFunction modeMap;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
configAttrs = filterAttrs (_: v: v != null) {
inherit (cfg) colorscheme active component componentFunction modeMap;
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lightline-vim ];
globals.lightline = mkIf (configAttrs != {}) configAttrs;
globals.lightline = mkIf (configAttrs != { }) configAttrs;
};
};
}

View file

@ -1,7 +1,7 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.lualine;
cfg = config.plugins.lualine;
helpers = import ../helpers.nix { lib = lib; };
separators = mkOption {
type = types.nullOr (types.submodule {
@ -43,13 +43,14 @@ let
});
default = null;
};
in {
in
{
options = {
programs.nixvim.plugins.lualine = {
plugins.lualine = {
enable = mkEnableOption "Enable lualine";
theme = mkOption {
default = config.programs.nixvim.colorscheme;
default = config.colorscheme;
type = types.nullOr types.str;
description = "The theme to use for lualine-nvim.";
};
@ -109,25 +110,25 @@ in {
};
};
};
config = let
setupOptions = {
options = {
theme = cfg.theme;
section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes;
always_divide_middle = cfg.alwaysDivideMiddle;
};
config =
let
setupOptions = {
options = {
theme = cfg.theme;
section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes;
always_divide_middle = cfg.alwaysDivideMiddle;
};
sections = cfg.sections;
tabline = cfg.tabline;
extensions = cfg.extensions;
};
in mkIf cfg.enable {
programs.nixvim = {
sections = cfg.sections;
tabline = cfg.tabline;
extensions = cfg.extensions;
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lualine-nvim ];
extraConfigLua =
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
};
};
}

View file

@ -1,7 +1,7 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope;
cfg = config.plugins.telescope;
helpers = (import ../helpers.nix { inherit lib; });
in
{
@ -14,13 +14,13 @@ in
# TODO:add support for aditional filetypes. This requires autocommands!
options.programs.nixvim.plugins.telescope = {
options.plugins.telescope = {
enable = mkEnableOption "Enable telescope.nvim";
highlightTheme = mkOption {
type = types.nullOr types.str;
description = "The colorscheme to use for syntax highlighting";
default = config.programs.nixvim.colorscheme;
default = config.colorscheme;
};
enabledExtensions = mkOption {
@ -37,32 +37,30 @@ in
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPackages = [ pkgs.bat ];
extraPackages = [ pkgs.bat ];
extraPlugins = with pkgs.vimPlugins; [
telescope-nvim
plenary-nvim
popup-nvim
];
extraPlugins = with pkgs.vimPlugins; [
telescope-nvim
plenary-nvim
popup-nvim
];
extraConfigVim = mkIf (cfg.highlightTheme != null) ''
let $BAT_THEME = '${cfg.highlightTheme}'
'';
extraConfigVim = mkIf (cfg.highlightTheme != null) ''
let $BAT_THEME = '${cfg.highlightTheme}'
'';
extraConfigLua = ''
do
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
extraConfigLua = ''
do
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
require('telescope').setup{
extensions = ${helpers.toLuaObject cfg.extensionConfig}
}
require('telescope').setup{
extensions = ${helpers.toLuaObject cfg.extensionConfig}
}
for i, extension in ipairs(__telescopeExtensions) do
require('telescope').load_extension(extension)
end
for i, extension in ipairs(__telescopeExtensions) do
require('telescope').load_extension(extension)
end
'';
};
end
'';
};
}

View file

@ -1,10 +1,10 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope.extensions.frecency;
cfg = config.plugins.telescope.extensions.frecency;
in
{
options.programs.nixvim.plugins.telescope.extensions.frecency = {
options.plugins.telescope.extensions.frecency = {
enable = mkEnableOption "Enable frecency";
dbRoot = mkOption {
@ -55,13 +55,13 @@ in
devicons_disabled = cfg.deviconsDisabled;
};
in mkIf cfg.enable {
programs.nixvim.extraPackages = [ pkgs.sqlite ];
programs.nixvim.extraPlugins = with pkgs.vimPlugins; [
extraPackages = [ pkgs.sqlite ];
extraPlugins = with pkgs.vimPlugins; [
telescope-frecency-nvim
sqlite-lua
];
programs.nixvim.plugins.telescope.enabledExtensions = [ "frecency" ];
programs.nixvim.plugins.telescope.extensionConfig."frecency" = configuration;
plugins.telescope.enabledExtensions = [ "frecency" ];
plugins.telescope.extensionConfig."frecency" = configuration;
};
}

View file

@ -1,10 +1,10 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope.extensions.fzf-native;
cfg = config.plugins.telescope.extensions.fzf-native;
in
{
options.programs.nixvim.plugins.telescope.extensions.fzf-native = {
options.plugins.telescope.extensions.fzf-native = {
enable = mkEnableOption "Enable fzf-native";
fuzzy = mkOption {
@ -36,9 +36,9 @@ in
case_mode = cfg.caseMode;
};
in mkIf cfg.enable {
programs.nixvim.extraPlugins = [ pkgs.vimPlugins.telescope-fzf-native-nvim ];
extraPlugins = [ pkgs.vimPlugins.telescope-fzf-native-nvim ];
programs.nixvim.plugins.telescope.enabledExtensions = [ "fzf" ];
programs.nixvim.plugins.telescope.extensionConfig."fzf" = configuration;
plugins.telescope.enabledExtensions = [ "fzf" ];
plugins.telescope.extensionConfig."fzf" = configuration;
};
}

View file

@ -1,10 +1,10 @@
{ pkgs, config, lib, ...}:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope.extensions.fzy-native;
cfg = config.plugins.telescope.extensions.fzy-native;
in
{
options.programs.nixvim.plugins.telescope.extensions.fzy-native = {
options.plugins.telescope.extensions.fzy-native = {
enable = mkEnableOption "Enable fzy-native";
overrideGenericSorter = mkOption {
@ -25,9 +25,9 @@ in
override_file_sorter = cfg.overrideFileSorter;
};
in mkIf cfg.enable {
programs.nixvim.extraPlugins = [ pkgs.vimPlugins.telescope-fzy-native-nvim ];
extraPlugins = [ pkgs.vimPlugins.telescope-fzy-native-nvim ];
programs.nixvim.plugins.telescope.enabledExtensions = [ "fzy_native" ];
programs.nixvim.plugins.telescope.extensionConfig."fzy_native" = configuration;
plugins.telescope.enabledExtensions = [ "fzy_native" ];
plugins.telescope.extensionConfig."fzy_native" = configuration;
};
}

View file

@ -1,10 +1,10 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope.extensions.media_files;
cfg = config.plugins.telescope.extensions.media_files;
in
{
options.programs.nixvim.plugins.telescope.extensions.media_files = {
options.plugins.telescope.extensions.media_files = {
enable = mkEnableOption "Enable media_files extension for telescope";
filetypes = mkOption {
@ -20,19 +20,16 @@ in
};
config = mkIf cfg.enable {
programs.nixvim = {
plugins.telescope.enabledExtensions = [ "media_files" ];
plugins.telescope.enabledExtensions = [ "media_files" ];
extraPlugins = with pkgs.vimPlugins; [
popup-nvim
plenary-nvim
telescope-media-files-nvim
];
extraPackages = with pkgs; [
ueberzug
];
};
extraPlugins = with pkgs.vimPlugins; [
popup-nvim
plenary-nvim
telescope-media-files-nvim
];
extraPackages = with pkgs; [
ueberzug
];
};
}

View file

@ -1,12 +1,12 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.comment-nvim;
cfg = config.plugins.comment-nvim;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
programs.nixvim.plugins.comment-nvim = {
plugins.comment-nvim = {
enable = mkEnableOption "Enable comment-nvim";
padding = mkOption {
type = types.nullOr types.bool;
@ -24,7 +24,7 @@ in
default = null;
};
toggler = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule ({ ... }: {
options = {
line = mkOption {
type = types.str;
@ -42,7 +42,7 @@ in
default = null;
};
opleader = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule ({ ... }: {
options = {
line = mkOption {
type = types.str;
@ -60,7 +60,7 @@ in
default = null;
};
mappings = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule ({ ... }: {
options = {
basic = mkOption {
type = types.bool;
@ -85,20 +85,20 @@ in
};
};
config = let
setupOptions = {
padding = cfg.padding;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
setupOptions = {
padding = cfg.padding;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.comment-nvim ];
extraConfigLua =
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
};
};
}

View file

@ -1,20 +1,18 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.commentary;
cfg = config.plugins.commentary;
in
{
# TODO Add support for aditional filetypes. This requires autocommands!
options = {
programs.nixvim.plugins.commentary = {
plugins.commentary = {
enable = mkEnableOption "Enable commentary";
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [ pkgs.vimPlugins.vim-commentary ];
};
extraPlugins = [ pkgs.vimPlugins.vim-commentary ];
};
}

View file

@ -1,13 +1,13 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.dashboard;
cfg = config.plugins.dashboard;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
programs.nixvim.plugins.dashboard = {
plugins.dashboard = {
enable = mkEnableOption "Enable dashboard";
header = mkOption {
@ -124,8 +124,8 @@ in
};
filteredOptions = filterAttrs (_: v: !isNull v) options;
in mkIf cfg.enable {
programs.nixvim = {
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.dashboard-nvim ];
extraConfigLua = ''
local dashboard = require("dashboard")
@ -135,5 +135,4 @@ in
filteredOptions)}
'';
};
};
}

View file

@ -1,20 +1,18 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.easyescape;
cfg = config.plugins.easyescape;
helpers = import ../helpers.nix { inherit lib; };
in
in
{
options = {
programs.nixvim.plugins.easyescape = {
plugins.easyescape = {
enable = mkEnableOption "Enable easyescape";
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
vim-easyescape
];
};
extraPlugins = with pkgs.vimPlugins; [
vim-easyescape
];
};
}

View file

@ -1,12 +1,12 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.floaterm;
let
cfg = config.plugins.floaterm;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
programs.nixvim.plugins.floaterm = {
plugins.floaterm = {
enable = mkEnableOption "Enable floaterm";
shell = mkOption {
type = types.nullOr types.str;
@ -64,23 +64,21 @@ in
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
vim-floaterm
];
globals = {
floaterm_shell = mkIf (!isNull cfg.shell) cfg.shell;
floaterm_title = mkIf (!isNull cfg.title) cfg.title;
floaterm_wintype = mkIf (!isNull cfg.winType) cfg.winType;
floaterm_width = mkIf (!isNull cfg.winWidth) cfg.winWidth;
floaterm_height = mkIf (!isNull cfg.winHeight) cfg.winHeight;
floaterm_borderchars = mkIf (!isNull cfg.borderChars) cfg.borderChars;
floaterm_rootmarkers = mkIf (!isNull cfg.rootMarkers) cfg.rootMarkers;
floaterm_opener = mkIf (!isNull cfg.opener) cfg.opener;
floaterm_autoclose = mkIf (!isNull cfg.autoClose) cfg.autoClose;
floaterm_autohide = mkIf (!isNull cfg.autoHide) cfg.autoHide;
floaterm_autoInsert = mkIf (!isNull cfg.autoInsert) cfg.autoInsert;
};
extraPlugins = with pkgs.vimPlugins; [
vim-floaterm
];
globals = {
floaterm_shell = mkIf (!isNull cfg.shell) cfg.shell;
floaterm_title = mkIf (!isNull cfg.title) cfg.title;
floaterm_wintype = mkIf (!isNull cfg.winType) cfg.winType;
floaterm_width = mkIf (!isNull cfg.winWidth) cfg.winWidth;
floaterm_height = mkIf (!isNull cfg.winHeight) cfg.winHeight;
floaterm_borderchars = mkIf (!isNull cfg.borderChars) cfg.borderChars;
floaterm_rootmarkers = mkIf (!isNull cfg.rootMarkers) cfg.rootMarkers;
floaterm_opener = mkIf (!isNull cfg.opener) cfg.opener;
floaterm_autoclose = mkIf (!isNull cfg.autoClose) cfg.autoClose;
floaterm_autohide = mkIf (!isNull cfg.autoHide) cfg.autoHide;
floaterm_autoInsert = mkIf (!isNull cfg.autoInsert) cfg.autoInsert;
};
};
}

View file

@ -1,24 +1,22 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.comment-nvim;
cfg = config.plugins.comment-nvim;
defs = import ../plugin-defs.nix { inherit pkgs; };
in
{
options = {
programs.nixvim.plugins.intellitab = {
plugins.intellitab = {
enable = mkEnableOption "intellitab.nvim";
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [ defs.intellitab-nvim ];
extraPlugins = [ defs.intellitab-nvim ];
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
plugins.treesitter = {
indent = true;
};
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
plugins.treesitter = {
indent = true;
};
};
}

View file

@ -2,11 +2,12 @@
with lib;
let
cfg = config.programs.nixvim.plugins.mark-radar;
cfg = config.plugins.mark-radar;
helpers = import ../helpers.nix { inherit lib; };
defs = import ../plugin-defs.nix { inherit pkgs; };
in {
options.programs.nixvim.plugins.mark-radar = {
in
{
options.plugins.mark-radar = {
enable = mkEnableOption "Enable mark-radar";
highlight_background = mkOption {
@ -30,19 +31,19 @@ in {
};
};
config = let
opts = helpers.toLuaObject {
inherit (cfg) highlight_group background_highlight_group;
set_default_mappings = cfg.set_default_keybinds;
background_highlight = cfg.highlight_background;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
opts = helpers.toLuaObject {
inherit (cfg) highlight_group background_highlight_group;
set_default_mappings = cfg.set_default_keybinds;
background_highlight = cfg.highlight_background;
};
in
mkIf cfg.enable {
extraPlugins = [ defs.mark-radar ];
extraConfigLua = ''
require("mark-radar").setup(${opts})
'';
};
};
}

View file

@ -1,15 +1,15 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.notify;
cfg = config.plugins.notify;
helpers = import ../helpers.nix { lib = lib; };
icon = mkOption {
type = types.nullOr types.str;
default = null;
};
in
in
{
options.programs.nixvim.plugins.notify = {
options.plugins.notify = {
enable = mkEnableOption "Enable notify";
stages = mkOption {
@ -43,31 +43,31 @@ in
};
});
description = "Icons for the different levels";
default = {};
default = { };
};
};
config = let
setupOptions = with cfg; {
stages = stages;
timeout = timeout;
background_color = backgroundColor;
minimum_width = minimumWidth;
icons = with icons; {
ERROR = error;
WARN = warn;
INFO = info;
DEBUG = debug;
TRACE = trace;
config =
let
setupOptions = with cfg; {
stages = stages;
timeout = timeout;
background_color = backgroundColor;
minimum_width = minimumWidth;
icons = with icons; {
ERROR = error;
WARN = warn;
INFO = info;
DEBUG = debug;
TRACE = trace;
};
};
};
in mkIf cfg.enable {
programs.nixvim = {
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-notify ];
extraConfigLua = ''
vim.notify = require('notify');
require('notify').setup(${helpers.toLuaObject setupOptions})
'';
};
};
}

View file

@ -1,11 +1,11 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.nvim-autopairs;
cfg = config.plugins.nvim-autopairs;
helpers = import ../helpers.nix { lib = lib; };
in
{
options.programs.nixvim.plugins.nvim-autopairs = {
options.plugins.nvim-autopairs = {
enable = mkEnableOption "Enable nvim-autopairs";
pairs = mkOption {
@ -39,21 +39,21 @@ in
};
};
config = let
options = {
pairs_map = cfg.pairs;
disable_filetype = cfg.disabledFiletypes;
break_line_filetype = cfg.breakLineFiletypes;
html_break_line_filetype = cfg.htmlFiletypes;
ignored_next_char = cfg.ignoredNextChar;
};
in mkIf cfg.enable {
programs.nixvim = {
config =
let
options = {
pairs_map = cfg.pairs;
disable_filetype = cfg.disabledFiletypes;
break_line_filetype = cfg.breakLineFiletypes;
html_break_line_filetype = cfg.htmlFiletypes;
ignored_next_char = cfg.ignoredNextChar;
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-autopairs ];
extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options})
'';
};
};
}

View file

@ -1,11 +1,11 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.nvim-tree;
cfg = config.plugins.nvim-tree;
helpers = import ../helpers.nix { lib = lib; };
in
{
options.programs.nixvim.plugins.nvim-tree = {
options.plugins.nvim-tree = {
enable = mkEnableOption "Enable nvim-tree";
disableNetrw = mkOption {
@ -14,7 +14,7 @@ in
description = "Disable netrw";
};
hijackNetrw = mkOption {
hijackNetrw = mkOption {
type = types.nullOr types.bool;
default = null;
description = "Hijack netrw";
@ -72,18 +72,20 @@ in
description = "Enable diagnostics";
};
icons = let
diagnosticOption = desc: mkOption {
type = types.nullOr types.str;
default = null;
description = desc;
icons =
let
diagnosticOption = desc: mkOption {
type = types.nullOr types.str;
default = null;
description = desc;
};
in
{
hint = diagnosticOption "Hints";
info = diagnosticOption "Info";
warning = diagnosticOption "Warning";
error = diagnosticOption "Error";
};
in {
hint = diagnosticOption "Hints";
info = diagnosticOption "Info";
warning = diagnosticOption "Warning";
error = diagnosticOption "Error";
};
};
updateFocusedFile = {
@ -201,57 +203,58 @@ in
};
};
config = let
options = {
disable_netrw = cfg.disableNetrw;
hijack_netrw = cfg.hijackNetrw;
open_on_setup = cfg.openOnSetup;
ignore_ft_on_setup = cfg.ignoreFtOnSetup;
auto_close = cfg.autoClose;
open_on_tab = cfg.openOnTab;
hijack_cursor = cfg.hijackCursor;
update_cwd = cfg.updateCwd;
update_to_buf_dir = {
enable = cfg.updateToBufDir.enable;
auto_open = cfg.updateToBufDir.autoOpen;
};
diagnostics = cfg.diagnostics;
updateFocusedFile = {
enable = cfg.updateFocusedFile.enable;
update_cwd = cfg.updateFocusedFile.updateCwd;
ignore_list = cfg.updateFocusedFile.ignoreList;
};
system_open = cfg.systemOpen;
filters = cfg.filters;
git = cfg.git;
view = {
width = cfg.view.width;
height = cfg.view.height;
hide_root_folder = cfg.view.hideRootFolder;
side = cfg.view.side;
auto_resize = cfg.view.autoResize;
mappings = {
custom_only = cfg.view.mappings.customOnly;
list = cfg.view.mappings.list;
config =
let
options = {
disable_netrw = cfg.disableNetrw;
hijack_netrw = cfg.hijackNetrw;
open_on_setup = cfg.openOnSetup;
ignore_ft_on_setup = cfg.ignoreFtOnSetup;
auto_close = cfg.autoClose;
open_on_tab = cfg.openOnTab;
hijack_cursor = cfg.hijackCursor;
update_cwd = cfg.updateCwd;
update_to_buf_dir = {
enable = cfg.updateToBufDir.enable;
auto_open = cfg.updateToBufDir.autoOpen;
};
diagnostics = cfg.diagnostics;
updateFocusedFile = {
enable = cfg.updateFocusedFile.enable;
update_cwd = cfg.updateFocusedFile.updateCwd;
ignore_list = cfg.updateFocusedFile.ignoreList;
};
system_open = cfg.systemOpen;
filters = cfg.filters;
git = cfg.git;
view = {
width = cfg.view.width;
height = cfg.view.height;
hide_root_folder = cfg.view.hideRootFolder;
side = cfg.view.side;
auto_resize = cfg.view.autoResize;
mappings = {
custom_only = cfg.view.mappings.customOnly;
list = cfg.view.mappings.list;
};
number = cfg.view.number;
relativenumber = cfg.view.relativenumber;
signcolumn = cfg.view.signcolumn;
};
trash = {
cmd = cfg.trash.cmd;
require_confirm = cfg.trash.requireConfirm;
};
number = cfg.view.number;
relativenumber = cfg.view.relativenumber;
signcolumn = cfg.view.signcolumn;
};
trash = {
cmd = cfg.trash.cmd;
require_confirm = cfg.trash.requireConfirm;
};
};
in mkIf cfg.enable {
programs.nixvim = {
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
nvim-tree-lua nvim-web-devicons
nvim-tree-lua
nvim-web-devicons
];
extraConfigLua = ''
require('nvim-tree').setup(${helpers.toLuaObject options})
'';
};
};
}

View file

@ -1,10 +1,11 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.specs;
cfg = config.plugins.specs;
helpers = import ../helpers.nix { inherit lib; };
in {
options.programs.nixvim.plugins.specs = {
in
{
options.plugins.specs = {
enable = mkEnableOption "Enable specs-nvim";
show_jumps = mkOption {
@ -104,36 +105,36 @@ in {
};
};
config = let
setup = helpers.toLuaObject {
inherit (cfg) show_jumps min_jump;
ignore_filetypes = attrsets.listToAttrs
(lib.lists.map (x: attrsets.nameValuePair x true)
cfg.ignored_filetypes);
ignore_buftypes = attrsets.listToAttrs
(lib.lists.map (x: attrsets.nameValuePair x true)
cfg.ignored_buffertypes);
popup = {
inherit (cfg) blend width;
delay_ms = cfg.delay;
inc_ms = cfg.increment;
fader = helpers.mkRaw (if cfg.fader.builtin == null then
cfg.fader.custom
else
''require("specs").${cfg.fader.builtin}'');
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
cfg.resizer.custom
else
''require("specs").${cfg.resizer.builtin}'');
config =
let
setup = helpers.toLuaObject {
inherit (cfg) show_jumps min_jump;
ignore_filetypes = attrsets.listToAttrs
(lib.lists.map (x: attrsets.nameValuePair x true)
cfg.ignored_filetypes);
ignore_buftypes = attrsets.listToAttrs
(lib.lists.map (x: attrsets.nameValuePair x true)
cfg.ignored_buffertypes);
popup = {
inherit (cfg) blend width;
delay_ms = cfg.delay;
inc_ms = cfg.increment;
fader = helpers.mkRaw (if cfg.fader.builtin == null then
cfg.fader.custom
else
''require("specs").${cfg.fader.builtin}'');
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
cfg.resizer.custom
else
''require("specs").${cfg.resizer.builtin}'');
};
};
};
in mkIf cfg.enable {
programs.nixvim = {
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.specs-nvim ];
extraConfigLua = ''
require('specs').setup(${setup})
'';
};
};
}

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.undotree;
cfg = config.plugins.undotree;
helpers = import ../helpers.nix { inherit lib; };
in {
in
{
options = {
programs.nixvim.plugins.undotree = {
plugins.undotree = {
enable = mkEnableOption "Enable undotree";
windowLayout = mkOption {
@ -107,27 +108,25 @@ in {
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [ pkgs.vimPlugins.undotree ];
extraPlugins = [ pkgs.vimPlugins.undotree ];
globals = {
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
undotree_ShortIndicators = mkIf cfg.shortIndicators 1;
undotree_SplitWidth = mkIf (cfg.windowWidth != null) cfg.windowWidth;
undotree_DiffpanelHeight = mkIf (cfg.diffHeight != null) cfg.diffHeight;
undotree_DiffAutoOpen = mkIf (!cfg.autoOpenDiff) 0;
undotree_SetFocusWhenToggle = mkIf cfg.focusOnToggle 1;
undotree_TreeNodeShape = mkIf (cfg.treeNodeShape != null) cfg.treeNodeShape;
undotree_DiffCommand = mkIf (cfg.diffCommand != null) cfg.diffCommand;
undotree_RelativeTimestamp = mkIf (!cfg.relativeTimestamp) 0;
undotree_HighlightChangedText = mkIf (!cfg.highlightChangedText) 0;
undotree_HighlightChangedWithSign = mkIf (!cfg.highlightChangesWithSign) 0;
undotree_HighlightSyntaxAdd = mkIf (cfg.highlightSyntaxAdd != null) cfg.highlightSyntaxAdd;
undotree_HighlightSyntaxChange = mkIf (cfg.highlightSyntaxChange != null) cfg.highlightSyntaxAdd;
undotree_HighlightSyntaxDel = mkIf (cfg.highlightSyntaxDel != null) cfg.highlightSyntaxDel;
undotree_HelpLine = mkIf (!cfg.showHelpLine) 0;
undotree_CursorLine = mkIf (!cfg.showCursorLine) 0;
};
globals = {
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
undotree_ShortIndicators = mkIf cfg.shortIndicators 1;
undotree_SplitWidth = mkIf (cfg.windowWidth != null) cfg.windowWidth;
undotree_DiffpanelHeight = mkIf (cfg.diffHeight != null) cfg.diffHeight;
undotree_DiffAutoOpen = mkIf (!cfg.autoOpenDiff) 0;
undotree_SetFocusWhenToggle = mkIf cfg.focusOnToggle 1;
undotree_TreeNodeShape = mkIf (cfg.treeNodeShape != null) cfg.treeNodeShape;
undotree_DiffCommand = mkIf (cfg.diffCommand != null) cfg.diffCommand;
undotree_RelativeTimestamp = mkIf (!cfg.relativeTimestamp) 0;
undotree_HighlightChangedText = mkIf (!cfg.highlightChangedText) 0;
undotree_HighlightChangedWithSign = mkIf (!cfg.highlightChangesWithSign) 0;
undotree_HighlightSyntaxAdd = mkIf (cfg.highlightSyntaxAdd != null) cfg.highlightSyntaxAdd;
undotree_HighlightSyntaxChange = mkIf (cfg.highlightSyntaxChange != null) cfg.highlightSyntaxAdd;
undotree_HighlightSyntaxDel = mkIf (cfg.highlightSyntaxDel != null) cfg.highlightSyntaxDel;
undotree_HelpLine = mkIf (!cfg.showHelpLine) 0;
undotree_CursorLine = mkIf (!cfg.showCursorLine) 0;
};
};
}