perform some statix linting and fixes

This commit is contained in:
Tanish2002 2023-05-22 15:45:47 +05:30 committed by Gaétan Lepage
parent eee375e97e
commit efdcbe225f
57 changed files with 196 additions and 221 deletions

View file

@ -5,7 +5,7 @@
... ...
}: let }: let
options = lib.evalModules { options = lib.evalModules {
modules = modules; inherit modules;
specialArgs = {inherit pkgs lib;}; specialArgs = {inherit pkgs lib;};
}; };
docs = pkgs.nixosOptionsDoc { docs = pkgs.nixosOptionsDoc {

View file

@ -33,7 +33,7 @@
pkgs = mkForce pkgs; pkgs = mkForce pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;}; helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
inputs = inputs; inherit inputs;
}; };
}; };
} }
@ -70,7 +70,7 @@
(import ./tests { (import ./tests {
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
makeNixvim = self.legacyPackages."${system}".makeNixvim; inherit (self.legacyPackages."${system}") makeNixvim;
}) })
// { // {
lib-tests = import ./tests/lib-tests.nix { lib-tests = import ./tests/lib-tests.nix {
@ -103,9 +103,7 @@
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "run-updates"; pname = "run-updates";
version = pkgs.rust-analyzer.version; inherit (pkgs.rust-analyzer) version src;
src = pkgs.rust-analyzer.src;
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra]; nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra];
@ -121,7 +119,7 @@
}) })
{}; {};
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory # Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
nvfetcher = pkgs.nvfetcher; inherit (pkgs) nvfetcher;
}; };
legacyPackages = rec { legacyPackages = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules; makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
@ -144,7 +142,7 @@
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "alejandra-excludes"; pname = "alejandra-excludes";
version = alejandra.version; inherit (alejandra) version;
dontUnpack = true; dontUnpack = true;
dontBuild = true; dontBuild = true;
@ -163,7 +161,7 @@
lib = import ./lib { lib = import ./lib {
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
makeNixvim = self.legacyPackages."${system}".makeNixvim; inherit (self.legacyPackages."${system}") makeNixvim;
}; };
}); });
in in

View file

@ -3,7 +3,7 @@ with lib; rec {
# vim dictionaries are, in theory, compatible with JSON # vim dictionaries are, in theory, compatible with JSON
toVimDict = args: toVimDict = args:
toJSON toJSON
(lib.filterAttrs (n: v: !isNull v) args); (lib.filterAttrs (n: v: v != null) args);
# Black functional magic that converts a bunch of different Nix types to their # Black functional magic that converts a bunch of different Nix types to their
# lua equivalents! # lua equivalents!
@ -25,7 +25,7 @@ with lib; rec {
(filterAttrs (filterAttrs
( (
n: v: n: v:
!isNull v && (toLuaObject v != "{}") v != null && (toLuaObject v != "{}")
) )
args))) args)))
+ "}" + "}"
@ -43,7 +43,7 @@ with lib; rec {
then "${toString args}" then "${toString args}"
else if builtins.isInt args else if builtins.isInt args
then "${toString args}" then "${toString args}"
else if isNull args else if (args == null)
then "nil" then "nil"
else ""; else "";
@ -68,7 +68,7 @@ with lib; rec {
# silent = false; # silent = false;
# }; # };
# }; # };
mkModeMaps = defaults: modeMaps: mkModeMaps = defaults:
mapAttrs mapAttrs
( (
shortcut: action: let shortcut: action: let
@ -78,8 +78,7 @@ with lib; rec {
else action; else action;
in in
defaults // actionAttrs defaults // actionAttrs
) );
modeMaps;
# Applies some default mapping options to a set of mappings # Applies some default mapping options to a set of mappings
# #
@ -92,10 +91,9 @@ with lib; rec {
# ... # ...
# }; # };
# } # }
mkMaps = defaults: maps: mkMaps = defaults:
mapAttrs mapAttrs
(name: modeMaps: (mkModeMaps defaults modeMaps)) (name: modeMaps: (mkModeMaps defaults modeMaps));
maps;
# Creates an option with a nullable type that defaults to null. # Creates an option with a nullable type that defaults to null.
mkNullOrOption = type: desc: mkNullOrOption = type: desc:
@ -105,12 +103,12 @@ with lib; rec {
description = desc; description = desc;
}; };
mkIfNonNull' = x: y: (mkIf (!isNull x) y); mkIfNonNull' = x: y: (mkIf (x != null) y);
mkIfNonNull = x: (mkIfNonNull' x x); mkIfNonNull = x: (mkIfNonNull' x x);
ifNonNull' = x: y: ifNonNull' = x: y:
if (isNull x) if (x == null)
then null then null
else y; else y;
@ -207,7 +205,7 @@ with lib; rec {
if builtins.isBool val if builtins.isBool val
then then
( (
if val == false if !val
then 0 then 0
else 1 else 1
) )

View file

@ -47,7 +47,7 @@ in {
}; };
config = { config = {
options.clipboard = mkIf (!isNull cfg.register) cfg.register; options.clipboard = mkIf (cfg.register != null) cfg.register;
extraPackages = extraPackages =
mapAttrsToList mapAttrsToList

View file

@ -94,8 +94,7 @@ with lib; let
normalizedAction = normalizeAction action; normalizedAction = normalizeAction action;
in { in {
inherit (normalizedAction) action config; inherit (normalizedAction) action config;
key = key; inherit key mode;
mode = mode;
}) })
maps); maps);

View file

@ -331,10 +331,10 @@ in {
optionName: funcName: let optionName: funcName: let
key = cfg.keymaps.${optionName}; key = cfg.keymaps.${optionName};
in in
mkIf (!isNull key) { mkIf (key != null) {
${key} = { ${key} = {
action = "<Cmd>Buffer${funcName}<CR>"; action = "<Cmd>Buffer${funcName}<CR>";
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
}; };
} }
) )

View file

@ -305,7 +305,7 @@ in {
inherit (cfg) offsets; inherit (cfg) offsets;
groups = helpers.ifNonNull' cfg.groups { groups = helpers.ifNonNull' cfg.groups {
inherit (cfg.groups) items; inherit (cfg.groups) items;
options = helpers.ifNonNull' (cfg.groups.options) { options = helpers.ifNonNull' cfg.groups.options {
toggle_hidden_on_enter = cfg.groups.options.toggleHiddenOnEnter; toggle_hidden_on_enter = cfg.groups.options.toggleHiddenOnEnter;
}; };
}; };

View file

@ -39,7 +39,7 @@ in {
colorscheme = "base16-${cfg.colorscheme}"; colorscheme = "base16-${cfg.colorscheme}";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
plugins.airline.theme = mkIf (cfg.setUpBar) "base16"; plugins.airline.theme = mkIf cfg.setUpBar "base16";
plugins.lightline.colorscheme = null; plugins.lightline.colorscheme = null;
options.termguicolors = mkIf cfg.useTruecolor true; options.termguicolors = mkIf cfg.useTruecolor true;

View file

@ -122,26 +122,26 @@ in {
globals = { globals = {
gruvbox_bold = mkIf (!cfg.bold) 0; gruvbox_bold = mkIf (!cfg.bold) 0;
gruvbox_italic = mkIf (cfg.italics) 1; gruvbox_italic = mkIf cfg.italics 1;
gruvbox_underline = mkIf (cfg.underline) 1; gruvbox_underline = mkIf cfg.underline 1;
gruvbox_undercurl = mkIf (cfg.undercurl) 1; gruvbox_undercurl = mkIf cfg.undercurl 1;
gruvbox_transparent_bg = mkIf (cfg.transparentBg) 0; gruvbox_transparent_bg = mkIf cfg.transparentBg 0;
gruvbox_contrast_dark = mkIf (!isNull cfg.contrastDark) cfg.contrastDark; gruvbox_contrast_dark = mkIf (cfg.contrastDark != null) cfg.contrastDark;
gruvbox_contrast_light = mkIf (!isNull cfg.contrastLight) cfg.contrastLight; gruvbox_contrast_light = mkIf (cfg.contrastLight != null) cfg.contrastLight;
gruvbox_hls_cursor = mkIf (!isNull cfg.highlightSearchCursor) cfg.highlightSearchCursor; gruvbox_hls_cursor = mkIf (cfg.highlightSearchCursor != null) cfg.highlightSearchCursor;
gruvbox_number_column = mkIf (!isNull cfg.numberColumn) cfg.numberColumn; gruvbox_number_column = mkIf (cfg.numberColumn != null) cfg.numberColumn;
gruvbox_sign_column = mkIf (!isNull cfg.signColumn) cfg.signColumn; gruvbox_sign_column = mkIf (cfg.signColumn != null) cfg.signColumn;
gruvbox_color_column = mkIf (!isNull cfg.colorColumn) cfg.colorColumn; gruvbox_color_column = mkIf (cfg.colorColumn != null) cfg.colorColumn;
gruvbox_vert_split = mkIf (!isNull cfg.vertSplitColor) cfg.vertSplitColor; gruvbox_vert_split = mkIf (cfg.vertSplitColor != null) cfg.vertSplitColor;
gruvbox_italicize_comments = mkIf (!cfg.italicizeComments) 0; gruvbox_italicize_comments = mkIf (!cfg.italicizeComments) 0;
gruvbox_italicize_strings = mkIf (cfg.italicizeStrings) 1; gruvbox_italicize_strings = mkIf cfg.italicizeStrings 1;
gruvbox_invert_selection = mkIf (!cfg.invertSelection) 0; gruvbox_invert_selection = mkIf (!cfg.invertSelection) 0;
gruvbox_invert_signs = mkIf (cfg.invertSigns) 1; gruvbox_invert_signs = mkIf cfg.invertSigns 1;
gruvbox_invert_indent_guides = mkIf (cfg.invertIndentGuides) 1; gruvbox_invert_indent_guides = mkIf cfg.invertIndentGuides 1;
gruvbox_invert_tabline = mkIf (cfg.invertTabline) 1; gruvbox_invert_tabline = mkIf cfg.invertTabline 1;
gruvbox_improved_strings = mkIf (cfg.improvedStrings) 1; gruvbox_improved_strings = mkIf cfg.improvedStrings 1;
gruvbox_improved_warnings = mkIf (cfg.improvedWarnings) 1; gruvbox_improved_warnings = mkIf cfg.improvedWarnings 1;
}; };
}; };
} }

View file

@ -52,8 +52,7 @@ in {
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable; doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
options = options =
{ {
mode = cfg.mode; inherit (cfg) mode preset;
preset = cfg.preset;
symbol_map = cfg.symbolMap; symbol_map = cfg.symbolMap;
} }
// ( // (
@ -61,7 +60,7 @@ in {
then { then {
maxwidth = cfg.cmp.maxWidth; maxwidth = cfg.cmp.maxWidth;
ellipsis_char = cfg.cmp.ellipsisChar; ellipsis_char = cfg.cmp.ellipsisChar;
menu = cfg.cmp.menu; inherit (cfg.cmp) menu;
} }
else {} else {}
) )

View file

@ -47,7 +47,7 @@ in {
mapping = mkOption { mapping = mkOption {
default = null; default = null;
type = with types; type = with types;
nullOr (attrsOf (either str (types.submodule ({...}: { nullOr (attrsOf (either str (types.submodule (_: {
options = { options = {
action = mkOption { action = mkOption {
type = types.nonEmptyStr; type = types.nonEmptyStr;
@ -259,7 +259,7 @@ in {
}; };
sources = let sources = let
source_config = types.submodule ({...}: { source_config = types.submodule (_: {
options = { options = {
name = mkOption { name = mkOption {
type = types.str; type = types.str;
@ -267,7 +267,7 @@ in {
example = ''"buffer"''; example = ''"buffer"'';
}; };
option = helpers.mkNullOrOption (types.attrs) '' option = helpers.mkNullOrOption types.attrs ''
Any specific options defined by the source itself. Any specific options defined by the source itself.
If direct lua code is needed use `helpers.mkRaw`. If direct lua code is needed use `helpers.mkRaw`.
@ -470,7 +470,7 @@ in {
then null then null
else false; else false;
performance = cfg.performance; inherit (cfg) performance;
preselect = preselect =
helpers.ifNonNull' cfg.preselect helpers.ifNonNull' cfg.preselect
(helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}"); (helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}");
@ -488,9 +488,9 @@ in {
if isString mapping if isString mapping
then mapping then mapping
else let else let
modes = mapping.modes; inherit (mapping) modes;
modesString = modesString =
optionalString (!isNull modes && ((length modes) >= 1)) optionalString (modes != null && ((length modes) >= 1))
("," + (helpers.toLuaObject mapping.modes)); ("," + (helpers.toLuaObject mapping.modes));
in "cmp.mapping(${mapping.action}${modesString})" in "cmp.mapping(${mapping.action}${modesString})"
)) ))
@ -510,7 +510,7 @@ in {
snippet = helpers.ifNonNull' cfg.snippet { snippet = helpers.ifNonNull' cfg.snippet {
expand = let expand = let
expand = cfg.snippet.expand; inherit (cfg.snippet) expand;
in in
if isString expand if isString expand
then then
@ -525,12 +525,12 @@ in {
completion = helpers.ifNonNull' cfg.completion { completion = helpers.ifNonNull' cfg.completion {
keyword_length = cfg.completion.keywordLength; keyword_length = cfg.completion.keywordLength;
keyword_pattern = let keyword_pattern = let
keywordPattern = cfg.completion.keywordPattern; inherit (cfg.completion) keywordPattern;
in in
helpers.ifNonNull' keywordPattern helpers.ifNonNull' keywordPattern
(helpers.mkRaw "[[${keywordPattern}]]"); (helpers.mkRaw "[[${keywordPattern}]]");
autocomplete = let autocomplete = let
autocomplete = cfg.completion.autocomplete; inherit (cfg.completion) autocomplete;
in in
if isList autocomplete if isList autocomplete
then then
@ -540,7 +540,7 @@ in {
autocomplete autocomplete
# either null or false # either null or false
else autocomplete; else autocomplete;
completeopt = cfg.completion.completeopt; inherit (cfg.completion) completeopt;
}; };
confirmation = helpers.ifNonNull' cfg.confirmation { confirmation = helpers.ifNonNull' cfg.confirmation {
@ -552,7 +552,7 @@ in {
formatting = helpers.ifNonNull' cfg.formatting { formatting = helpers.ifNonNull' cfg.formatting {
expandable_indicator = cfg.formatting.expandableIndicator; expandable_indicator = cfg.formatting.expandableIndicator;
fields = cfg.formatting.fields; inherit (cfg.formatting) fields;
format = format =
helpers.ifNonNull' cfg.formatting.format helpers.ifNonNull' cfg.formatting.format
(helpers.mkRaw cfg.formatting.format); (helpers.mkRaw cfg.formatting.format);
@ -569,7 +569,7 @@ in {
sorting = helpers.ifNonNull' cfg.sorting { sorting = helpers.ifNonNull' cfg.sorting {
priority_weight = cfg.sorting.priorityWeight; priority_weight = cfg.sorting.priorityWeight;
comparators = let comparators = let
comparators = cfg.sorting.comparators; inherit (cfg.sorting) comparators;
in in
helpers.ifNonNull' comparators helpers.ifNonNull' comparators
( (
@ -605,7 +605,7 @@ in {
cfg.sources cfg.sources
); );
view = cfg.view; inherit (cfg) view;
window = helpers.ifNonNull' cfg.window { window = helpers.ifNonNull' cfg.window {
completion = helpers.ifNonNull' cfg.window.completion { completion = helpers.ifNonNull' cfg.window.completion {
inherit inherit
@ -627,20 +627,20 @@ in {
zindex zindex
; ;
max_width = let max_width = let
maxWidth = cfg.window.documentation.maxWidth; inherit (cfg.window.documentation) maxWidth;
in in
if isInt maxWidth if isInt maxWidth
then maxWidth then maxWidth
else helpers.ifNonNull' maxWidth (helpers.mkRaw maxWidth); else helpers.ifNonNull' maxWidth (helpers.mkRaw maxWidth);
max_height = let max_height = let
maxHeight = cfg.window.documentation.maxHeight; inherit (cfg.window.documentation) maxHeight;
in in
if isInt maxHeight if isInt maxHeight
then maxHeight then maxHeight
else helpers.ifNonNull' maxHeight (helpers.mkRaw maxHeight); else helpers.ifNonNull' maxHeight (helpers.mkRaw maxHeight);
}; };
}; };
experimental = cfg.experimental; inherit (cfg) experimental;
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -655,7 +655,7 @@ in {
# and enable the corresponding plugins. # and enable the corresponding plugins.
plugins = let plugins = let
flattened_sources = flattened_sources =
if (isNull cfg.sources) if (cfg.sources == null)
then [] then []
else flatten cfg.sources; else flatten cfg.sources;
# Take only the names from the sources provided by the user # Take only the names from the sources provided by the user

View file

@ -1026,9 +1026,9 @@ in {
# Concatenate sources and extraSources, setting sources to it's default value if it is null # Concatenate sources and extraSources, setting sources to it's default value if it is null
# and extraSources is not null # and extraSources is not null
sources = sources =
if (!isNull cfg.extraSources) if (cfg.extraSources != null)
then then
if (isNull cfg.sources) if (cfg.sources == null)
then ["filesystem" "git_status" "buffers"] ++ cfg.extraSources then ["filesystem" "git_status" "buffers"] ++ cfg.extraSources
else cfg.sources ++ cfg.extraSources else cfg.sources ++ cfg.extraSources
else cfg.sources; else cfg.sources;

View file

@ -7,7 +7,7 @@
with lib; let with lib; let
cfg = config.plugins.nvim-tree; cfg = config.plugins.nvim-tree;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
ifNonNull' = helpers.ifNonNull'; inherit (helpers) ifNonNull';
openWinConfigOption = openWinConfigOption =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable

View file

@ -190,25 +190,25 @@ in {
extraPackages = [pkgs.git] ++ grepPackage; extraPackages = [pkgs.git] ++ grepPackage;
globals = { globals = {
gitgutter_max_signs = mkIf (!isNull cfg.maxSigns) cfg.maxSigns; gitgutter_max_signs = mkIf (cfg.maxSigns != null) cfg.maxSigns;
gitgutter_show_msg_on_hunk_jumping = mkIf (!cfg.showMessageOnHunkJumping) 0; gitgutter_show_msg_on_hunk_jumping = mkIf (!cfg.showMessageOnHunkJumping) 0;
gitgutter_map_keys = mkIf (!cfg.defaultMaps) 0; gitgutter_map_keys = mkIf (!cfg.defaultMaps) 0;
gitgutter_sign_allow_clobber = mkIf (cfg.allowClobberSigns) 1; gitgutter_sign_allow_clobber = mkIf cfg.allowClobberSigns 1;
gitgutter_sign_priority = mkIf (!isNull cfg.signPriority) cfg.signPriority; gitgutter_sign_priority = mkIf (cfg.signPriority != null) cfg.signPriority;
gitgutter_set_sign_backgrounds = mkIf (cfg.matchBackgrounds) 1; gitgutter_set_sign_backgrounds = mkIf cfg.matchBackgrounds 1;
gitgutter_sign_added = mkIf (!isNull cfg.signs.added) cfg.signs.added; gitgutter_sign_added = mkIf (cfg.signs.added != null) cfg.signs.added;
gitgutter_sign_modified = mkIf (!isNull cfg.signs.modified) cfg.signs.modified; gitgutter_sign_modified = mkIf (cfg.signs.modified != null) cfg.signs.modified;
gitgutter_sign_removed = mkIf (!isNull cfg.signs.removed) cfg.signs.removed; gitgutter_sign_removed = mkIf (cfg.signs.removed != null) cfg.signs.removed;
gitgutter_sign_removed_first_line = mkIf (!isNull cfg.signs.removedFirstLine) cfg.signs.removedFirstLine; gitgutter_sign_removed_first_line = mkIf (cfg.signs.removedFirstLine != null) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (!isNull cfg.signs.removedAboveAndBelow) cfg.signs.removedAboveAndBelow; gitgutter_sign_removed_above_and_bellow = mkIf (cfg.signs.removedAboveAndBelow != null) cfg.signs.removedAboveAndBelow;
gitgutter_sign_modified_above = mkIf (!isNull cfg.signs.modifiedAbove) cfg.signs.modifiedAbove; gitgutter_sign_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
gitgutter_diff_relative_to = mkIf (cfg.diffRelativeToWorkingTree) "working_tree"; gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";
gitgutter_git_args = mkIf (cfg.extraGitArgs != "") cfg.extraGitArgs; gitgutter_git_args = mkIf (cfg.extraGitArgs != "") cfg.extraGitArgs;
gitgutter_diff_args = mkIf (cfg.extraDiffArgs != "") cfg.extraDiffArgs; gitgutter_diff_args = mkIf (cfg.extraDiffArgs != "") cfg.extraDiffArgs;
gitgutter_grep = mkIf (!isNull grepCommand) grepCommand; gitgutter_grep = mkIf (grepCommand != null) grepCommand;
gitgutter_enabled = mkIf (!cfg.enableByDefault) 0; gitgutter_enabled = mkIf (!cfg.enableByDefault) 0;
gitgutter_signs = mkIf (!cfg.signsByDefault) 0; gitgutter_signs = mkIf (!cfg.signsByDefault) 0;
@ -216,8 +216,8 @@ in {
gitgutter_highlight_lines = mkIf (!cfg.highlightLines) 0; gitgutter_highlight_lines = mkIf (!cfg.highlightLines) 0;
gitgutter_highlight_linenrs = mkIf (!cfg.highlightLineNumbers) 0; gitgutter_highlight_linenrs = mkIf (!cfg.highlightLineNumbers) 0;
gitgutter_async = mkIf (!cfg.runAsync) 0; gitgutter_async = mkIf (!cfg.runAsync) 0;
gitgutter_preview_win_floating = mkIf (cfg.previewWinFloating) 1; gitgutter_preview_win_floating = mkIf cfg.previewWinFloating 1;
gitgutter_use_location_list = mkIf (cfg.useLocationList) 1; gitgutter_use_location_list = mkIf cfg.useLocationList 1;
gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0; gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0;
}; };

View file

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

View file

@ -117,7 +117,7 @@ in
setupOptions = { setupOptions = {
server = cfg.server.extraOptions; server = cfg.server.extraOptions;
extensions = { extensions = {
autoSetHints = cfg.extensions.autoSetHints; inherit (cfg.extensions) autoSetHints;
inlay_hints = { inlay_hints = {
only_current_line = cfg.extensions.inlayHints.onlyCurrentLine; only_current_line = cfg.extensions.inlayHints.onlyCurrentLine;
only_current_line_autocmd = cfg.extensions.inlayHints.onlyCurrentLineAutocmd; only_current_line_autocmd = cfg.extensions.inlayHints.onlyCurrentLineAutocmd;
@ -128,16 +128,11 @@ in
max_len_align_padding = cfg.extensions.inlayHints.maxLenAlignPadding; max_len_align_padding = cfg.extensions.inlayHints.maxLenAlignPadding;
right_align = cfg.extensions.inlayHints.rightAlign; right_align = cfg.extensions.inlayHints.rightAlign;
right_align_padding = cfg.extensions.inlayHints.rightAlignPadding; right_align_padding = cfg.extensions.inlayHints.rightAlignPadding;
highlight = cfg.extensions.inlayHints.highlight; inherit (cfg.extensions.inlayHints) highlight priority;
priority = cfg.extensions.inlayHints.priority;
}; };
ast = { ast = {
role_icons = { role_icons = {
type = cfg.extensions.ast.roleIcons.type; inherit (cfg.extensions.ast.roleIcons) type declaration expression statement specifier;
declaration = cfg.extensions.ast.roleIcons.declaration;
expression = cfg.extensions.ast.roleIcons.expression;
statement = cfg.extensions.ast.roleIcons.statement;
specifier = cfg.extensions.ast.roleIcons.specifier;
"template argument" = cfg.extensions.ast.roleIcons.templateArgument; "template argument" = cfg.extensions.ast.roleIcons.templateArgument;
}; };
kind_icons = { kind_icons = {
@ -150,14 +145,14 @@ in
TemplateParamObject = cfg.extensions.ast.kindIcons.templateParamObject; TemplateParamObject = cfg.extensions.ast.kindIcons.templateParamObject;
}; };
highlights = { highlights = {
detail = cfg.extensions.ast.highlights.detail; inherit (cfg.extensions.ast.highlights) detail;
}; };
}; };
memory_usage = { memory_usage = {
border = cfg.extensions.memoryUsage.border; inherit (cfg.extensions.memoryUsage) border;
}; };
symbol_info = { symbol_info = {
border = cfg.extensions.symbolInfo.border; inherit (cfg.extensions.symbolInfo) border;
}; };
}; };
}; };

View file

@ -99,22 +99,22 @@ in {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
globals = { globals = {
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart; mkdp_auto_start = mkIf (cfg.autoStart != null) cfg.autoStart;
mkdp_auto_close = mkIf (!isNull cfg.autoClose) cfg.autoClose; mkdp_auto_close = mkIf (cfg.autoClose != null) cfg.autoClose;
mkdp_refresh_slow = mkIf (!isNull cfg.refreshSlow) cfg.refreshSlow; mkdp_refresh_slow = mkIf (cfg.refreshSlow != null) cfg.refreshSlow;
mkdp_command_for_global = mkIf (!isNull cfg.commandForGlobal) cfg.commandForGlobal; mkdp_command_for_global = mkIf (cfg.commandForGlobal != null) cfg.commandForGlobal;
mkdp_open_to_the_world = mkIf (!isNull cfg.openToTheWorld) cfg.openToTheWorld; mkdp_open_to_the_world = mkIf (cfg.openToTheWorld != null) cfg.openToTheWorld;
mkdp_open_ip = mkIf (!isNull cfg.openIp) cfg.openIp; mkdp_open_ip = mkIf (cfg.openIp != null) cfg.openIp;
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser; mkdp_browser = mkIf (cfg.browser != null) cfg.browser;
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl; mkdp_echo_preview_url = mkIf (cfg.echoPreviewUrl != null) cfg.echoPreviewUrl;
mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc; mkdp_browserfunc = mkIf (cfg.browserFunc != null) cfg.browserFunc;
mkdp_preview_options = mkIf (!isNull cfg.previewOptions) cfg.previewOptions; mkdp_preview_options = mkIf (cfg.previewOptions != null) cfg.previewOptions;
mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss; mkdp_markdown_css = mkIf (cfg.markdownCss != null) cfg.markdownCss;
mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss; mkdp_highlight_css = mkIf (cfg.highlightCss != null) cfg.highlightCss;
mkdp_port = mkIf (!isNull cfg.port) cfg.port; mkdp_port = mkIf (cfg.port != null) cfg.port;
mkdp_page_title = mkIf (!isNull cfg.pageTitle) cfg.pageTitle; mkdp_page_title = mkIf (cfg.pageTitle != null) cfg.pageTitle;
mkdp_filetypes = mkIf (!isNull cfg.fileTypes) cfg.fileTypes; mkdp_filetypes = mkIf (cfg.fileTypes != null) cfg.fileTypes;
mkdp_theme = mkIf (!isNull cfg.theme) cfg.theme; mkdp_theme = mkIf (cfg.theme != null) cfg.theme;
}; };
}; };
} }

View file

@ -71,7 +71,7 @@ in {
''; '';
settings = settings =
helpers.mkNullOrOption (types.attrs) helpers.mkNullOrOption types.attrs
'' ''
Here you can configure eclipse.jdt.ls specific settings Here you can configure eclipse.jdt.ls specific settings
See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
@ -79,7 +79,7 @@ in {
''; '';
initOptions = initOptions =
helpers.mkNullOrOption (types.attrs) helpers.mkNullOrOption types.attrs
'' ''
Language server `initializationOptions` Language server `initializationOptions`
You need to extend the `bundles` with paths to jar files if you want to use additional You need to extend the `bundles` with paths to jar files if you want to use additional
@ -93,10 +93,10 @@ in {
config = let config = let
cmd = cmd =
if isNull cfg.cmd if (cfg.cmd == null)
then let then let
data = data =
if isNull cfg.data if (cfg.data == null)
then then
throw '' throw ''
You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd' You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd'
@ -109,7 +109,7 @@ in {
] ]
++ ["-data" data] ++ ["-data" data]
++ ( ++ (
optionals (!isNull cfg.configuration) optionals (cfg.configuration != null)
["-configuration" cfg.configuration] ["-configuration" cfg.configuration]
) )
else cfg.cmd; else cfg.cmd;

View file

@ -45,7 +45,7 @@ in {
config = let config = let
cfg = config.plugins.openscad; cfg = config.plugins.openscad;
fuzzyFinder = fuzzyFinder =
if isNull cfg.fuzzyFinder if (cfg.fuzzyFinder == null)
then defaultFuzzyFinder then defaultFuzzyFinder
else cfg.fuzzyFinder; else cfg.fuzzyFinder;
in in

View file

@ -89,7 +89,7 @@ in {
"Customize highlight groups (setting this overrides colorscheme)" "Customize highlight groups (setting this overrides colorscheme)"
( (
mapAttrs mapAttrs
(optionName: defaults: colorOption defaults) (optionName: colorOption)
{ {
SniprunVirtualTextOk = { SniprunVirtualTextOk = {
bg = "#66eeff"; bg = "#66eeff";
@ -131,7 +131,7 @@ in {
++ ( ++ (
optional optional
( (
(!isNull cfg.display) (cfg.display != null)
&& (any (hasPrefix "NvimNotify") cfg.display) && (any (hasPrefix "NvimNotify") cfg.display)
) )
nvim-notify nvim-notify

View file

@ -27,6 +27,6 @@ in
extraPackages = [pkgs.ctags]; extraPackages = [pkgs.ctags];
globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig; globals = mapAttrs' (name: nameValuePair ("tagbar_" + name)) cfg.extraConfig;
}; };
} }

View file

@ -58,7 +58,7 @@ in {
toggle_language_display = cfg.keybindings.toggleLanguageDisplay; toggle_language_display = cfg.keybindings.toggleLanguageDisplay;
focus_language = cfg.keybindings.focusLanguage; focus_language = cfg.keybindings.focusLanguage;
unfocus_language = cfg.keybindings.unfocusLanguage; unfocus_language = cfg.keybindings.unfocusLanguage;
update = cfg.keybindings.update; inherit (cfg.keybindings) update;
goto_node = cfg.keybindings.gotoNode; goto_node = cfg.keybindings.gotoNode;
show_help = cfg.keybindings.showHelp; show_help = cfg.keybindings.showHelp;
}; };

View file

@ -102,7 +102,7 @@ in {
tsOptions = tsOptions =
{ {
highlight = { highlight = {
enable = cfg.enable; inherit (cfg) enable;
disable = disable =
if (cfg.disabledLanguages != []) if (cfg.disabledLanguages != [])
then cfg.disabledLanguages then cfg.disabledLanguages

View file

@ -40,6 +40,6 @@ in
# Usefull for inverse search # Usefull for inverse search
extraPackages = with pkgs; [pstree xdotool]; extraPackages = with pkgs; [pstree xdotool];
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals; globals = mapAttrs' (name: nameValuePair ("vimtex_" + name)) globals;
}; };
} }

View file

@ -114,7 +114,7 @@ in {
diagnosticMaps = diagnosticMaps =
mapAttrs mapAttrs
(key: action: { (key: action: {
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
action = "vim.diagnostic.${action}"; action = "vim.diagnostic.${action}";
lua = true; lua = true;
}) })
@ -123,7 +123,7 @@ in {
lspBuf = lspBuf =
mapAttrs mapAttrs
(key: action: { (key: action: {
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
action = "vim.lsp.buf.${action}"; action = "vim.lsp.buf.${action}";
lua = true; lua = true;
}) })

View file

@ -212,7 +212,7 @@ with lib; let
}; };
workspace = { workspace = {
library = mkOption { library = mkOption {
type = types.nullOr (types.either types.str (helpers.rawType)); type = types.nullOr (types.either types.str helpers.rawType);
description = '' description = ''
An array of abosolute or workspace-relative paths that will be added to the workspace An array of abosolute or workspace-relative paths that will be added to the workspace
diagnosis - meaning you will get completion and context from these library files. diagnosis - meaning you will get completion and context from these library files.
@ -356,6 +356,6 @@ with lib; let
]; ];
in { in {
imports = imports =
lib.lists.map (lspHelpers.mkLsp) servers lib.lists.map lspHelpers.mkLsp servers
++ [./pylsp.nix]; ++ [./pylsp.nix];
} }

View file

@ -16,12 +16,10 @@ in {
type = lib.types.nullOr (types.enum ["pycodestyle" "flake8"]); type = lib.types.nullOr (types.enum ["pycodestyle" "flake8"]);
description = "List of configuration sources to use."; description = "List of configuration sources to use.";
default = null; default = null;
apply = ( apply = value:
value:
if (value != null) if (value != null)
then [value] then [value]
else null else null;
);
}; };
plugins = { plugins = {
@ -502,8 +500,8 @@ in {
mkIf cfg.enable mkIf cfg.enable
{ {
extraPackages = let extraPackages = let
isEnabled = x: (!isNull x) && (x.enabled == true); isEnabled = x: (x != null) && (x.enabled != null && x.enabled);
plugins = cfg.settings.plugins; inherit (cfg.settings) plugins;
in in
lists.flatten ( lists.flatten (
(map (map

View file

@ -63,7 +63,7 @@ in {
Specifying a timeout with a value less than zero will prevent commands from timing out. Specifying a timeout with a value less than zero will prevent commands from timing out.
''; '';
diagnosticConfig = helpers.defaultNullOpts.mkNullable (types.attrs) "null" '' diagnosticConfig = helpers.defaultNullOpts.mkNullable types.attrs "null" ''
Specifies diagnostic display options for null-ls sources, as described in Specifies diagnostic display options for null-ls sources, as described in
`:help vim.diagnostic.config()`. `:help vim.diagnostic.config()`.
(null-ls uses separate namespaces for each source, so server-wide configuration will not work (null-ls uses separate namespaces for each source, so server-wide configuration will not work

View file

@ -59,7 +59,7 @@
plugins.null-ls.sourcesItems = let plugins.null-ls.sourcesItems = let
sourceItem = "${sourceType}.${name}"; sourceItem = "${sourceType}.${name}";
withArgs = withArgs =
if (isNull cfg.withArgs) if (cfg.withArgs == null)
then sourceItem then sourceItem
else "${sourceItem}.with ${cfg.withArgs}"; else "${sourceItem}.with ${cfg.withArgs}";
finalString = ''require("null-ls").builtins.${withArgs}''; finalString = ''require("null-ls").builtins.${withArgs}'';

View file

@ -84,13 +84,12 @@
serverDataFormatted = serverDataFormatted =
lib.mapAttrsToList lib.mapAttrsToList
( (
sourceType: sourceSet: sourceType: lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;})
lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet
) )
serverData; serverData;
dataFlattened = lib.flatten serverDataFormatted; dataFlattened = lib.flatten serverDataFormatted;
in { in {
imports = lib.lists.map (helpers.mkServer) dataFlattened; imports = lib.lists.map helpers.mkServer dataFlattened;
config = let config = let
cfg = config.plugins.null-ls; cfg = config.plugins.null-ls;

View file

@ -71,15 +71,15 @@ in {
[ [
cfg.package cfg.package
] ]
++ optional (!isNull cfg.theme) vim-airline-themes; ++ optional (cfg.theme != null) vim-airline-themes;
globals = globals =
{ {
airline.extensions = cfg.extensions; airline.extensions = cfg.extensions;
airline_statusline_ontop = mkIf cfg.onTop 1; airline_statusline_ontop = mkIf cfg.onTop 1;
airline_powerline_fonts = mkIf (cfg.powerline) 1; airline_powerline_fonts = mkIf cfg.powerline 1;
airline_theme = mkIf (!isNull cfg.theme) cfg.theme; airline_theme = mkIf (cfg.theme != null) cfg.theme;
} }
// sections; // sections;
}; };

View file

@ -214,18 +214,16 @@ in {
inherit icons_enabled icon separator color padding; inherit icons_enabled icon separator color padding;
} }
extraConfig; extraConfig;
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections; processSections = mapAttrs (_: mapNullable (map processComponent));
setupOptions = { setupOptions = {
options = { options = {
inherit (cfg) theme globalstatus refresh extensions;
icons_enabled = cfg.iconsEnabled; icons_enabled = cfg.iconsEnabled;
theme = cfg.theme;
section_separators = cfg.sectionSeparators; section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators; component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes; disabled_filetypes = cfg.disabledFiletypes;
ignore_focus = cfg.ignoreFocus; ignore_focus = cfg.ignoreFocus;
always_divide_middle = cfg.alwaysDivideMiddle; always_divide_middle = cfg.alwaysDivideMiddle;
globalstatus = cfg.globalstatus;
refresh = cfg.refresh;
}; };
sections = mapNullable processSections cfg.sections; sections = mapNullable processSections cfg.sections;
@ -233,7 +231,6 @@ in {
tabline = mapNullable processSections cfg.tabline; tabline = mapNullable processSections cfg.tabline;
winbar = mapNullable processSections cfg.winbar; winbar = mapNullable processSections cfg.winbar;
inactive_winbar = mapNullable processSections cfg.inactiveWinbar; inactive_winbar = mapNullable processSections cfg.inactiveWinbar;
extensions = cfg.extensions;
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {

View file

@ -92,7 +92,7 @@ in {
options = options =
{ {
extensions = cfg.extensionConfig; extensions = cfg.extensionConfig;
defaults = cfg.defaults; inherit (cfg) defaults;
} }
// cfg.extraOptions; // cfg.extraOptions;
in '' in ''

View file

@ -56,7 +56,7 @@ in {
default_workspace = cfg.defaultWorkspace; default_workspace = cfg.defaultWorkspace;
ignore_patterns = cfg.ignorePatterns; ignore_patterns = cfg.ignorePatterns;
show_scores = cfg.showScores; show_scores = cfg.showScores;
workspaces = cfg.workspaces; inherit (cfg) workspaces;
show_unindexed = cfg.showUnindexed; show_unindexed = cfg.showUnindexed;
devicons_disabled = cfg.deviconsDisabled; devicons_disabled = cfg.deviconsDisabled;
}; };

View file

@ -36,7 +36,7 @@ in {
config = let config = let
configuration = { configuration = {
fuzzy = cfg.fuzzy; inherit (cfg) fuzzy;
override_generic_sorter = cfg.overrideGenericSorter; override_generic_sorter = cfg.overrideGenericSorter;
override_file_sorter = cfg.overrideFileSorter; override_file_sorter = cfg.overrideFileSorter;
case_mode = cfg.caseMode; case_mode = cfg.caseMode;

View file

@ -308,7 +308,7 @@ in {
inherit (cfgLP) enabled format throttle view; inherit (cfgLP) enabled format throttle view;
format_done = cfgLP.formatDone; format_done = cfgLP.formatDone;
}; };
override = cfgL.override; inherit (cfgL) override;
hover = helpers.ifNonNull' cfgL.hover { hover = helpers.ifNonNull' cfgL.hover {
inherit (cfgL.hover) enabled view opts; inherit (cfgL.hover) enabled view opts;
}; };

View file

@ -30,7 +30,7 @@ in {
default = null; default = null;
}; };
toggler = mkOption { toggler = mkOption {
type = types.nullOr (types.submodule ({...}: { type = types.nullOr (types.submodule (_: {
options = { options = {
line = mkOption { line = mkOption {
type = types.str; type = types.str;
@ -48,7 +48,7 @@ in {
default = null; default = null;
}; };
opleader = mkOption { opleader = mkOption {
type = types.nullOr (types.submodule ({...}: { type = types.nullOr (types.submodule (_: {
options = { options = {
line = mkOption { line = mkOption {
type = types.str; type = types.str;
@ -66,7 +66,7 @@ in {
default = null; default = null;
}; };
mappings = mkOption { mappings = mkOption {
type = types.nullOr (types.submodule ({...}: { type = types.nullOr (types.submodule (_: {
options = { options = {
basic = mkOption { basic = mkOption {
type = types.bool; type = types.bool;
@ -93,12 +93,7 @@ in {
config = let config = let
setupOptions = { setupOptions = {
padding = cfg.padding; inherit (cfg) padding sticky ignore toggler opleader mappings;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {

View file

@ -127,7 +127,7 @@ in {
session_directory = cfg.sessionDirectory; session_directory = cfg.sessionDirectory;
}; };
filteredOptions = filterAttrs (_: v: !isNull v) options; filteredOptions = filterAttrs (_: v: v != null) options;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];

View file

@ -54,11 +54,11 @@ in {
}; };
''; '';
navNext = helpers.mkNullOrOption (types.str) '' navNext = helpers.mkNullOrOption types.str ''
Keymap for navigating to next mark."; Keymap for navigating to next mark.";
''; '';
navPrev = helpers.mkNullOrOption (types.str) '' navPrev = helpers.mkNullOrOption types.str ''
Keymap for navigating to previous mark."; Keymap for navigating to previous mark.";
''; '';
@ -171,11 +171,10 @@ in {
mark_branch = cfg.markBranch; mark_branch = cfg.markBranch;
}; };
projects = projects; inherit projects;
menu = { menu = {
width = cfg.menu.width; inherit (cfg.menu) width height;
height = cfg.menu.height;
borderchars = cfg.menu.borderChars; borderchars = cfg.menu.borderChars;
}; };
} }
@ -197,13 +196,14 @@ in {
( (
optionName: luaFunc: let optionName: luaFunc: let
key = km.${optionName}; key = km.${optionName};
in (mkIf (key != null) { in
mkIf (key != null) {
${key} = { ${key} = {
action = luaFunc; action = luaFunc;
lua = true; lua = true;
inherit silent; inherit silent;
}; };
}) }
) )
{ {
addFile = "require('harpoon.mark').add_file"; addFile = "require('harpoon.mark').add_file";

View file

@ -118,14 +118,14 @@ in
lazy_loading = cfg.lazyLoading; lazy_loading = cfg.lazyLoading;
logger = { logger = {
plugin = cfg.logger.plugin; inherit (cfg.logger) plugin;
use_console = cfg.logger.useConsole; use_console = cfg.logger.useConsole;
highlights = cfg.logger.highlights; inherit (cfg.logger) highlights;
use_file = cfg.logger.useFile; use_file = cfg.logger.useFile;
level = cfg.logger.level; inherit (cfg.logger) level;
modes = modes =
if (isNull cfg.logger.modes) if (cfg.logger.modes == null)
then null then null
else else
attrsets.mapAttrsToList attrsets.mapAttrsToList
@ -133,7 +133,7 @@ in
name = mode; name = mode;
inherit (modeConfig) hl; inherit (modeConfig) hl;
level = let level = let
level = modeConfig.level; inherit (modeConfig) level;
in in
if (isInt level) if (isInt level)
then level then level

View file

@ -54,8 +54,7 @@ in {
config = let config = let
setupOptions = with cfg; { setupOptions = with cfg; {
stages = stages; inherit stages timeout;
timeout = timeout;
background_colour = backgroundColour; background_colour = backgroundColour;
minimum_width = minimumWidth; minimum_width = minimumWidth;
icons = with icons; { icons = with icons; {

View file

@ -101,7 +101,7 @@ in {
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
plugins.treesitter.enable = mkIf (cfg.checkTs == true) true; plugins.treesitter.enable = mkIf (cfg.checkTs != null && cfg.checkTs) true;
extraConfigLua = '' extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options}) require('nvim-autopairs').setup(${helpers.toLuaObject options})

View file

@ -136,7 +136,7 @@ in {
inherit wrap; inherit wrap;
buf_label = bufLabel; buf_label = bufLabel;
should_preview_cb = should_preview_cb =
if isNull shouldPreviewCb if (shouldPreviewCb == null)
then null then null
else helpers.mkRaw shouldPreviewCb; else helpers.mkRaw shouldPreviewCb;
}; };

View file

@ -61,19 +61,19 @@ in
action = "require('osc52').copy_operator"; action = "require('osc52').copy_operator";
expr = true; expr = true;
lua = true; lua = true;
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
}; };
"${cfg.keymaps.copyLine}" = { "${cfg.keymaps.copyLine}" = {
action = "${cfg.keymaps.copy}_"; action = "${cfg.keymaps.copy}_";
remap = true; remap = true;
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
}; };
}; };
visual = { visual = {
"${cfg.keymaps.copyVisual}" = { "${cfg.keymaps.copyVisual}" = {
action = "require('osc52').copy_visual"; action = "require('osc52').copy_visual";
lua = true; lua = true;
silent = cfg.keymaps.silent; inherit (cfg.keymaps) silent;
}; };
}; };
}; };

View file

@ -161,10 +161,10 @@ in {
log_level = cfg.logLevel; log_level = cfg.logLevel;
debounce_timeout = cfg.debounceTimeout; debounce_timeout = cfg.debounceTimeout;
enable_line_number = cfg.enableLineNumber; enable_line_number = cfg.enableLineNumber;
blacklist = cfg.blacklist; inherit (cfg) blacklist;
file_assets = cfg.fileAssets; file_assets = cfg.fileAssets;
show_time = cfg.showTime; show_time = cfg.showTime;
buttons = cfg.buttons; inherit (cfg) buttons;
# Rich presence text options. # Rich presence text options.
editing_text = cfg.editingText; editing_text = cfg.editingText;

View file

@ -66,7 +66,7 @@ in {
{ {
manual_mode = cfg.manualMode; manual_mode = cfg.manualMode;
detection_methods = cfg.detectionMethods; detection_methods = cfg.detectionMethods;
patterns = cfg.patterns; inherit (cfg) patterns;
ignore_lsp = cfg.ignoreLsp; ignore_lsp = cfg.ignoreLsp;
exclude_dirs = cfg.excludeDirs; exclude_dirs = cfg.excludeDirs;
show_hidden = cfg.showHidden; show_hidden = cfg.showHidden;

View file

@ -129,7 +129,7 @@ in {
popup = { popup = {
inherit (cfg) blend width; inherit (cfg) blend width;
winhl = winhl =
if (!isNull cfg.color) if (cfg.color != null)
then "SpecsPopColor" then "SpecsPopColor"
else "PMenu"; else "PMenu";
delay_ms = cfg.delay; delay_ms = cfg.delay;
@ -150,7 +150,7 @@ in {
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color; highlight.SpecsPopColor.bg = mkIf (cfg.color != null) cfg.color;
extraConfigLua = '' extraConfigLua = ''
require('specs').setup(${setup}) require('specs').setup(${setup})

View file

@ -222,9 +222,9 @@ in {
config = let config = let
setupOptions = setupOptions =
{ {
signs = cfg.signs; inherit (cfg) signs;
sign_priority = cfg.signPriority; sign_priority = cfg.signPriority;
keywords = cfg.keywords; inherit (cfg) keywords;
gui_style = cfg.guiStyle; gui_style = cfg.guiStyle;
merge_keywords = cfg.mergeKeywords; merge_keywords = cfg.mergeKeywords;
highlight = helpers.ifNonNull' cfg.highlight { highlight = helpers.ifNonNull' cfg.highlight {
@ -244,14 +244,14 @@ in {
comments_only = cfg.highlight.commentsOnly; comments_only = cfg.highlight.commentsOnly;
max_line_len = cfg.highlight.maxLineLen; max_line_len = cfg.highlight.maxLineLen;
}; };
colors = cfg.colors; inherit (cfg) colors;
search = helpers.ifNonNull' cfg.search { search = helpers.ifNonNull' cfg.search {
inherit (cfg.search) command args; inherit (cfg.search) command args;
pattern = pattern =
helpers.ifNonNull' cfg.search.pattern helpers.ifNonNull' cfg.search.pattern
( (
if isList cfg.search.pattern if isList cfg.search.pattern
then (map (p: helpers.mkRaw p) cfg.search.pattern) then (map helpers.mkRaw cfg.search.pattern)
else helpers.mkRaw "[[${cfg.search.pattern}]]" else helpers.mkRaw "[[${cfg.search.pattern}]]"
); );
}; };
@ -266,7 +266,7 @@ in {
maps.normal = let maps.normal = let
silent = cfg.keymapsSilent; silent = cfg.keymapsSilent;
keymaps = cfg.keymaps; inherit (cfg) keymaps;
in in
mkMerge ( mkMerge (
mapAttrsToList mapAttrsToList
@ -274,25 +274,26 @@ in {
optionName: funcName: let optionName: funcName: let
keymap = keymaps.${optionName}; keymap = keymaps.${optionName};
key = keymap.key; inherit (keymap) key;
cwd = optionalString (!isNull keymap.cwd) " cwd=${keymap.cwd}"; cwd = optionalString (keymap.cwd != null) " cwd=${keymap.cwd}";
keywords = optionalString (!isNull keymap.keywords) " keywords=${keymap.keywords}"; keywords = optionalString (keymap.keywords != null) " keywords=${keymap.keywords}";
action = ":${funcName}${cwd}${keywords}<CR>"; action = ":${funcName}${cwd}${keywords}<CR>";
in (mkIf (keymap != null) { in
mkIf (keymap != null) {
${key} = { ${key} = {
inherit silent action; inherit silent action;
}; };
}) }
) )
commands commands
); );
# Automatically enable plugins if keymaps have been set # Automatically enable plugins if keymaps have been set
plugins = mkMerge [ plugins = mkMerge [
(mkIf (!isNull cfg.keymaps.todoTrouble) {trouble.enable = true;}) (mkIf (cfg.keymaps.todoTrouble != null) {trouble.enable = true;})
(mkIf (!isNull cfg.keymaps.todoTelescope) {telescope.enable = true;}) (mkIf (cfg.keymaps.todoTelescope != null) {telescope.enable = true;})
]; ];
}; };
} }

View file

@ -34,14 +34,14 @@ in {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
maps.normal = with cfg.keymaps; maps.normal = with cfg.keymaps;
(optionalAttrs (!isNull bdelete) (optionalAttrs (bdelete != null)
{ {
${bdelete} = { ${bdelete} = {
action = ":Bdelete<CR>"; action = ":Bdelete<CR>";
silent = cfg.keymapsSilent; silent = cfg.keymapsSilent;
}; };
}) })
// (optionalAttrs (!isNull bwipeout) // (optionalAttrs (bwipeout != null)
{ {
${bwipeout} = { ${bwipeout} = {
action = ":Bwipeout<CR>"; action = ":Bwipeout<CR>";

View file

@ -5,7 +5,7 @@
}: let }: let
fetchTests = import ./fetch-tests.nix; fetchTests = import ./fetch-tests.nix;
test-derivation = import ./test-derivation.nix {inherit pkgs makeNixvim;}; test-derivation = import ./test-derivation.nix {inherit pkgs makeNixvim;};
mkTestDerivation = test-derivation.mkTestDerivation; inherit (test-derivation) mkTestDerivation;
# List of files containing configurations # List of files containing configurations
testFiles = fetchTests { testFiles = fetchTests {

View file

@ -61,7 +61,7 @@
cases; cases;
# Helper function that calls `//` for each attrset of a list # Helper function that calls `//` for each attrset of a list
concatMany = list: lib.lists.foldr lib.mergeAttrs {} list; concatMany = lib.lists.foldr lib.mergeAttrs {};
# An attrset of 'test-name' -> 'test-config' # An attrset of 'test-name' -> 'test-config'
in in
concatMany (builtins.map handleTestFile testsListEvaluated) concatMany (builtins.map handleTestFile testsListEvaluated)

View file

@ -11,7 +11,7 @@
... ...
}: }:
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
name = name; inherit name;
nativeBuildInputs = [nvim pkgs.docker-client]; nativeBuildInputs = [nvim pkgs.docker-client];

View file

@ -27,8 +27,7 @@ in {
environment.systemPackages = [cfg.finalPackage]; environment.systemPackages = [cfg.finalPackage];
} }
{ {
warnings = cfg.warnings; inherit (cfg) warnings assertions;
assertions = cfg.assertions;
} }
]); ]);
} }

View file

@ -34,8 +34,7 @@ in {
xdg.configFile = files; xdg.configFile = files;
}) })
{ {
warnings = cfg.warnings; inherit (cfg) warnings assertions;
assertions = cfg.assertions;
} }
]); ]);
} }

View file

@ -44,9 +44,9 @@ in {
}; };
config = let config = let
files = config.files; inherit (config) files;
concatFilesOption = attr: concatFilesOption = attr:
lib.flatten (lib.mapAttrsToList (_: file: builtins.getAttr attr file) files); lib.flatten (lib.mapAttrsToList (_: builtins.getAttr attr) files);
in { in {
# Each file can declare plugins/packages/warnings/assertions # Each file can declare plugins/packages/warnings/assertions
extraPlugins = concatFilesOption "extraPlugins"; extraPlugins = concatFilesOption "extraPlugins";
@ -59,7 +59,7 @@ in {
name = "nixvim-config"; name = "nixvim-config";
paths = paths =
(lib.mapAttrsToList (_: file: file.plugin) files) (lib.mapAttrsToList (_: file: file.plugin) files)
++ (lib.mapAttrsToList (path: content: pkgs.writeTextDir path content) config.extraFiles); ++ (lib.mapAttrsToList pkgs.writeTextDir config.extraFiles);
}; };
}; };
} }

View file

@ -113,7 +113,7 @@ in {
extraWrapperArgs = builtins.concatStringsSep " " ( extraWrapperArgs = builtins.concatStringsSep " " (
(optional (config.extraPackages != []) (optional (config.extraPackages != [])
''--prefix PATH : "${makeBinPath config.extraPackages}"'') ''--prefix PATH : "${makeBinPath config.extraPackages}"'')
++ (optional (config.wrapRc) ++ (optional config.wrapRc
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'') ''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
); );

View file

@ -35,8 +35,7 @@ in {
environment.variables."VIM" = "/etc/nvim"; environment.variables."VIM" = "/etc/nvim";
}) })
{ {
warnings = cfg.warnings; inherit (cfg) warnings assertions;
assertions = cfg.assertions;
} }
]); ]);
} }