diff --git a/docs.nix b/docs.nix index 939e9b58..9eea6862 100644 --- a/docs.nix +++ b/docs.nix @@ -5,7 +5,7 @@ ... }: let options = lib.evalModules { - modules = modules; + inherit modules; specialArgs = {inherit pkgs lib;}; }; docs = pkgs.nixosOptionsDoc { diff --git a/flake.nix b/flake.nix index 909009c5..395f224f 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,7 @@ pkgs = mkForce pkgs; inherit (pkgs) lib; helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;}; - inputs = inputs; + inherit inputs; }; }; } @@ -70,7 +70,7 @@ (import ./tests { inherit pkgs; inherit (pkgs) lib; - makeNixvim = self.legacyPackages."${system}".makeNixvim; + inherit (self.legacyPackages."${system}") makeNixvim; }) // { lib-tests = import ./tests/lib-tests.nix { @@ -103,9 +103,7 @@ }: stdenv.mkDerivation { pname = "run-updates"; - version = pkgs.rust-analyzer.version; - - src = pkgs.rust-analyzer.src; + inherit (pkgs.rust-analyzer) version src; nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra]; @@ -121,7 +119,7 @@ }) {}; # Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory - nvfetcher = pkgs.nvfetcher; + inherit (pkgs) nvfetcher; }; legacyPackages = rec { makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules; @@ -144,7 +142,7 @@ }: stdenv.mkDerivation { pname = "alejandra-excludes"; - version = alejandra.version; + inherit (alejandra) version; dontUnpack = true; dontBuild = true; @@ -163,7 +161,7 @@ lib = import ./lib { inherit pkgs; inherit (pkgs) lib; - makeNixvim = self.legacyPackages."${system}".makeNixvim; + inherit (self.legacyPackages."${system}") makeNixvim; }; }); in diff --git a/lib/helpers.nix b/lib/helpers.nix index ecc709a3..a94aea05 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -3,7 +3,7 @@ with lib; rec { # vim dictionaries are, in theory, compatible with JSON toVimDict = args: 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 # lua equivalents! @@ -25,7 +25,7 @@ with lib; rec { (filterAttrs ( n: v: - !isNull v && (toLuaObject v != "{}") + v != null && (toLuaObject v != "{}") ) args))) + "}" @@ -43,7 +43,7 @@ with lib; rec { then "${toString args}" else if builtins.isInt args then "${toString args}" - else if isNull args + else if (args == null) then "nil" else ""; @@ -68,7 +68,7 @@ with lib; rec { # silent = false; # }; # }; - mkModeMaps = defaults: modeMaps: + mkModeMaps = defaults: mapAttrs ( shortcut: action: let @@ -78,8 +78,7 @@ with lib; rec { else action; in defaults // actionAttrs - ) - modeMaps; + ); # Applies some default mapping options to a set of mappings # @@ -92,10 +91,9 @@ with lib; rec { # ... # }; # } - mkMaps = defaults: maps: + mkMaps = defaults: mapAttrs - (name: modeMaps: (mkModeMaps defaults modeMaps)) - maps; + (name: modeMaps: (mkModeMaps defaults modeMaps)); # Creates an option with a nullable type that defaults to null. mkNullOrOption = type: desc: @@ -105,12 +103,12 @@ with lib; rec { description = desc; }; - mkIfNonNull' = x: y: (mkIf (!isNull x) y); + mkIfNonNull' = x: y: (mkIf (x != null) y); mkIfNonNull = x: (mkIfNonNull' x x); ifNonNull' = x: y: - if (isNull x) + if (x == null) then null else y; @@ -207,7 +205,7 @@ with lib; rec { if builtins.isBool val then ( - if val == false + if !val then 0 else 1 ) diff --git a/modules/clipboard.nix b/modules/clipboard.nix index efed8597..27c8b815 100644 --- a/modules/clipboard.nix +++ b/modules/clipboard.nix @@ -47,7 +47,7 @@ in { }; config = { - options.clipboard = mkIf (!isNull cfg.register) cfg.register; + options.clipboard = mkIf (cfg.register != null) cfg.register; extraPackages = mapAttrsToList diff --git a/modules/keymaps.nix b/modules/keymaps.nix index 314d4b99..12b0a90b 100644 --- a/modules/keymaps.nix +++ b/modules/keymaps.nix @@ -60,7 +60,7 @@ with lib; let { action = action; config = { - inherit (action) + inherit (action) }; } */ @@ -94,8 +94,7 @@ with lib; let normalizedAction = normalizeAction action; in { inherit (normalizedAction) action config; - key = key; - mode = mode; + inherit key mode; }) maps); diff --git a/plugins/bufferlines/barbar.nix b/plugins/bufferlines/barbar.nix index 6abc4468..ba9f3e91 100644 --- a/plugins/bufferlines/barbar.nix +++ b/plugins/bufferlines/barbar.nix @@ -331,10 +331,10 @@ in { optionName: funcName: let key = cfg.keymaps.${optionName}; in - mkIf (!isNull key) { + mkIf (key != null) { ${key} = { action = "Buffer${funcName}"; - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; }; } ) diff --git a/plugins/bufferlines/bufferline.nix b/plugins/bufferlines/bufferline.nix index 6c713962..38577e0e 100644 --- a/plugins/bufferlines/bufferline.nix +++ b/plugins/bufferlines/bufferline.nix @@ -305,7 +305,7 @@ in { inherit (cfg) offsets; groups = helpers.ifNonNull' cfg.groups { inherit (cfg.groups) items; - options = helpers.ifNonNull' (cfg.groups.options) { + options = helpers.ifNonNull' cfg.groups.options { toggle_hidden_on_enter = cfg.groups.options.toggleHiddenOnEnter; }; }; diff --git a/plugins/colorschemes/base16.nix b/plugins/colorschemes/base16.nix index a8a8fb83..3eaae494 100644 --- a/plugins/colorschemes/base16.nix +++ b/plugins/colorschemes/base16.nix @@ -39,7 +39,7 @@ in { colorscheme = "base16-${cfg.colorscheme}"; extraPlugins = [cfg.package]; - plugins.airline.theme = mkIf (cfg.setUpBar) "base16"; + plugins.airline.theme = mkIf cfg.setUpBar "base16"; plugins.lightline.colorscheme = null; options.termguicolors = mkIf cfg.useTruecolor true; diff --git a/plugins/colorschemes/gruvbox.nix b/plugins/colorschemes/gruvbox.nix index 94a351d3..4ca6aeae 100644 --- a/plugins/colorschemes/gruvbox.nix +++ b/plugins/colorschemes/gruvbox.nix @@ -122,26 +122,26 @@ in { 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_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 (cfg.contrastDark != null) cfg.contrastDark; + gruvbox_contrast_light = mkIf (cfg.contrastLight != null) cfg.contrastLight; + gruvbox_hls_cursor = mkIf (cfg.highlightSearchCursor != null) cfg.highlightSearchCursor; + gruvbox_number_column = mkIf (cfg.numberColumn != null) cfg.numberColumn; + gruvbox_sign_column = mkIf (cfg.signColumn != null) cfg.signColumn; + gruvbox_color_column = mkIf (cfg.colorColumn != null) cfg.colorColumn; + gruvbox_vert_split = mkIf (cfg.vertSplitColor != null) cfg.vertSplitColor; 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_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_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; }; }; } diff --git a/plugins/completion/lspkind.nix b/plugins/completion/lspkind.nix index d2a3cb40..23fcb217 100644 --- a/plugins/completion/lspkind.nix +++ b/plugins/completion/lspkind.nix @@ -52,8 +52,7 @@ in { doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable; options = { - mode = cfg.mode; - preset = cfg.preset; + inherit (cfg) mode preset; symbol_map = cfg.symbolMap; } // ( @@ -61,7 +60,7 @@ in { then { maxwidth = cfg.cmp.maxWidth; ellipsis_char = cfg.cmp.ellipsisChar; - menu = cfg.cmp.menu; + inherit (cfg.cmp) menu; } else {} ) diff --git a/plugins/completion/nvim-cmp/default.nix b/plugins/completion/nvim-cmp/default.nix index 6e723418..6c2d75d5 100644 --- a/plugins/completion/nvim-cmp/default.nix +++ b/plugins/completion/nvim-cmp/default.nix @@ -47,7 +47,7 @@ in { mapping = mkOption { default = null; type = with types; - nullOr (attrsOf (either str (types.submodule ({...}: { + nullOr (attrsOf (either str (types.submodule (_: { options = { action = mkOption { type = types.nonEmptyStr; @@ -259,7 +259,7 @@ in { }; sources = let - source_config = types.submodule ({...}: { + source_config = types.submodule (_: { options = { name = mkOption { type = types.str; @@ -267,7 +267,7 @@ in { example = ''"buffer"''; }; - option = helpers.mkNullOrOption (types.attrs) '' + option = helpers.mkNullOrOption types.attrs '' Any specific options defined by the source itself. If direct lua code is needed use `helpers.mkRaw`. @@ -470,7 +470,7 @@ in { then null else false; - performance = cfg.performance; + inherit (cfg) performance; preselect = helpers.ifNonNull' cfg.preselect (helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}"); @@ -488,9 +488,9 @@ in { if isString mapping then mapping else let - modes = mapping.modes; + inherit (mapping) modes; modesString = - optionalString (!isNull modes && ((length modes) >= 1)) + optionalString (modes != null && ((length modes) >= 1)) ("," + (helpers.toLuaObject mapping.modes)); in "cmp.mapping(${mapping.action}${modesString})" )) @@ -510,7 +510,7 @@ in { snippet = helpers.ifNonNull' cfg.snippet { expand = let - expand = cfg.snippet.expand; + inherit (cfg.snippet) expand; in if isString expand then @@ -525,12 +525,12 @@ in { completion = helpers.ifNonNull' cfg.completion { keyword_length = cfg.completion.keywordLength; keyword_pattern = let - keywordPattern = cfg.completion.keywordPattern; + inherit (cfg.completion) keywordPattern; in helpers.ifNonNull' keywordPattern (helpers.mkRaw "[[${keywordPattern}]]"); autocomplete = let - autocomplete = cfg.completion.autocomplete; + inherit (cfg.completion) autocomplete; in if isList autocomplete then @@ -540,7 +540,7 @@ in { autocomplete # either null or false else autocomplete; - completeopt = cfg.completion.completeopt; + inherit (cfg.completion) completeopt; }; confirmation = helpers.ifNonNull' cfg.confirmation { @@ -552,7 +552,7 @@ in { formatting = helpers.ifNonNull' cfg.formatting { expandable_indicator = cfg.formatting.expandableIndicator; - fields = cfg.formatting.fields; + inherit (cfg.formatting) fields; format = helpers.ifNonNull' cfg.formatting.format (helpers.mkRaw cfg.formatting.format); @@ -569,7 +569,7 @@ in { sorting = helpers.ifNonNull' cfg.sorting { priority_weight = cfg.sorting.priorityWeight; comparators = let - comparators = cfg.sorting.comparators; + inherit (cfg.sorting) comparators; in helpers.ifNonNull' comparators ( @@ -605,7 +605,7 @@ in { cfg.sources ); - view = cfg.view; + inherit (cfg) view; window = helpers.ifNonNull' cfg.window { completion = helpers.ifNonNull' cfg.window.completion { inherit @@ -627,20 +627,20 @@ in { zindex ; max_width = let - maxWidth = cfg.window.documentation.maxWidth; + inherit (cfg.window.documentation) maxWidth; in if isInt maxWidth then maxWidth else helpers.ifNonNull' maxWidth (helpers.mkRaw maxWidth); max_height = let - maxHeight = cfg.window.documentation.maxHeight; + inherit (cfg.window.documentation) maxHeight; in if isInt maxHeight then maxHeight else helpers.ifNonNull' maxHeight (helpers.mkRaw maxHeight); }; }; - experimental = cfg.experimental; + inherit (cfg) experimental; }; in mkIf cfg.enable { @@ -655,7 +655,7 @@ in { # and enable the corresponding plugins. plugins = let flattened_sources = - if (isNull cfg.sources) + if (cfg.sources == null) then [] else flatten cfg.sources; # Take only the names from the sources provided by the user diff --git a/plugins/filetrees/neo-tree.nix b/plugins/filetrees/neo-tree.nix index b56a96b0..fe841857 100644 --- a/plugins/filetrees/neo-tree.nix +++ b/plugins/filetrees/neo-tree.nix @@ -1026,9 +1026,9 @@ in { # Concatenate sources and extraSources, setting sources to it's default value if it is null # and extraSources is not null sources = - if (!isNull cfg.extraSources) + if (cfg.extraSources != null) then - if (isNull cfg.sources) + if (cfg.sources == null) then ["filesystem" "git_status" "buffers"] ++ cfg.extraSources else cfg.sources ++ cfg.extraSources else cfg.sources; diff --git a/plugins/filetrees/nvim-tree.nix b/plugins/filetrees/nvim-tree.nix index 4dd2971f..ef724636 100644 --- a/plugins/filetrees/nvim-tree.nix +++ b/plugins/filetrees/nvim-tree.nix @@ -7,7 +7,7 @@ with lib; let cfg = config.plugins.nvim-tree; helpers = import ../helpers.nix {inherit lib;}; - ifNonNull' = helpers.ifNonNull'; + inherit (helpers) ifNonNull'; openWinConfigOption = helpers.defaultNullOpts.mkNullable diff --git a/plugins/git/gitgutter.nix b/plugins/git/gitgutter.nix index e1ab6209..c6ca7bbf 100644 --- a/plugins/git/gitgutter.nix +++ b/plugins/git/gitgutter.nix @@ -190,25 +190,25 @@ in { extraPackages = [pkgs.git] ++ grepPackage; 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_map_keys = mkIf (!cfg.defaultMaps) 0; - gitgutter_sign_allow_clobber = mkIf (cfg.allowClobberSigns) 1; - gitgutter_sign_priority = mkIf (!isNull cfg.signPriority) cfg.signPriority; - gitgutter_set_sign_backgrounds = mkIf (cfg.matchBackgrounds) 1; + gitgutter_sign_allow_clobber = mkIf cfg.allowClobberSigns 1; + gitgutter_sign_priority = mkIf (cfg.signPriority != null) cfg.signPriority; + gitgutter_set_sign_backgrounds = mkIf cfg.matchBackgrounds 1; - gitgutter_sign_added = mkIf (!isNull cfg.signs.added) cfg.signs.added; - gitgutter_sign_modified = mkIf (!isNull cfg.signs.modified) cfg.signs.modified; - gitgutter_sign_removed = mkIf (!isNull cfg.signs.removed) cfg.signs.removed; - gitgutter_sign_removed_first_line = mkIf (!isNull cfg.signs.removedFirstLine) cfg.signs.removedFirstLine; - gitgutter_sign_removed_above_and_bellow = mkIf (!isNull cfg.signs.removedAboveAndBelow) cfg.signs.removedAboveAndBelow; - gitgutter_sign_modified_above = mkIf (!isNull cfg.signs.modifiedAbove) cfg.signs.modifiedAbove; + gitgutter_sign_added = mkIf (cfg.signs.added != null) cfg.signs.added; + gitgutter_sign_modified = mkIf (cfg.signs.modified != null) cfg.signs.modified; + gitgutter_sign_removed = mkIf (cfg.signs.removed != null) cfg.signs.removed; + gitgutter_sign_removed_first_line = mkIf (cfg.signs.removedFirstLine != null) cfg.signs.removedFirstLine; + gitgutter_sign_removed_above_and_bellow = mkIf (cfg.signs.removedAboveAndBelow != null) cfg.signs.removedAboveAndBelow; + 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_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_signs = mkIf (!cfg.signsByDefault) 0; @@ -216,8 +216,8 @@ in { gitgutter_highlight_lines = mkIf (!cfg.highlightLines) 0; gitgutter_highlight_linenrs = mkIf (!cfg.highlightLineNumbers) 0; gitgutter_async = mkIf (!cfg.runAsync) 0; - gitgutter_preview_win_floating = mkIf (cfg.previewWinFloating) 1; - gitgutter_use_location_list = mkIf (cfg.useLocationList) 1; + gitgutter_preview_win_floating = mkIf cfg.previewWinFloating 1; + gitgutter_use_location_list = mkIf cfg.useLocationList 1; gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0; }; diff --git a/plugins/helpers.nix b/plugins/helpers.nix index 9d501be8..8522d04d 100644 --- a/plugins/helpers.nix +++ b/plugins/helpers.nix @@ -1 +1 @@ -args: import ../lib/helpers.nix args +import ../lib/helpers.nix diff --git a/plugins/languages/clangd-extensions.nix b/plugins/languages/clangd-extensions.nix index 12351b9a..690b3caf 100644 --- a/plugins/languages/clangd-extensions.nix +++ b/plugins/languages/clangd-extensions.nix @@ -117,7 +117,7 @@ in setupOptions = { server = cfg.server.extraOptions; extensions = { - autoSetHints = cfg.extensions.autoSetHints; + inherit (cfg.extensions) autoSetHints; inlay_hints = { only_current_line = cfg.extensions.inlayHints.onlyCurrentLine; only_current_line_autocmd = cfg.extensions.inlayHints.onlyCurrentLineAutocmd; @@ -128,16 +128,11 @@ in max_len_align_padding = cfg.extensions.inlayHints.maxLenAlignPadding; right_align = cfg.extensions.inlayHints.rightAlign; right_align_padding = cfg.extensions.inlayHints.rightAlignPadding; - highlight = cfg.extensions.inlayHints.highlight; - priority = cfg.extensions.inlayHints.priority; + inherit (cfg.extensions.inlayHints) highlight priority; }; ast = { role_icons = { - type = cfg.extensions.ast.roleIcons.type; - declaration = cfg.extensions.ast.roleIcons.declaration; - expression = cfg.extensions.ast.roleIcons.expression; - statement = cfg.extensions.ast.roleIcons.statement; - specifier = cfg.extensions.ast.roleIcons.specifier; + inherit (cfg.extensions.ast.roleIcons) type declaration expression statement specifier; "template argument" = cfg.extensions.ast.roleIcons.templateArgument; }; kind_icons = { @@ -150,14 +145,14 @@ in TemplateParamObject = cfg.extensions.ast.kindIcons.templateParamObject; }; highlights = { - detail = cfg.extensions.ast.highlights.detail; + inherit (cfg.extensions.ast.highlights) detail; }; }; memory_usage = { - border = cfg.extensions.memoryUsage.border; + inherit (cfg.extensions.memoryUsage) border; }; symbol_info = { - border = cfg.extensions.symbolInfo.border; + inherit (cfg.extensions.symbolInfo) border; }; }; }; diff --git a/plugins/languages/markdown-preview.nix b/plugins/languages/markdown-preview.nix index ae92f878..16b1dfd6 100644 --- a/plugins/languages/markdown-preview.nix +++ b/plugins/languages/markdown-preview.nix @@ -99,22 +99,22 @@ in { extraPlugins = [cfg.package]; globals = { - mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart; - mkdp_auto_close = mkIf (!isNull cfg.autoClose) cfg.autoClose; - mkdp_refresh_slow = mkIf (!isNull cfg.refreshSlow) cfg.refreshSlow; - mkdp_command_for_global = mkIf (!isNull cfg.commandForGlobal) cfg.commandForGlobal; - mkdp_open_to_the_world = mkIf (!isNull cfg.openToTheWorld) cfg.openToTheWorld; - mkdp_open_ip = mkIf (!isNull cfg.openIp) cfg.openIp; - mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser; - mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl; - mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc; - mkdp_preview_options = mkIf (!isNull cfg.previewOptions) cfg.previewOptions; - mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss; - mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss; - mkdp_port = mkIf (!isNull cfg.port) cfg.port; - mkdp_page_title = mkIf (!isNull cfg.pageTitle) cfg.pageTitle; - mkdp_filetypes = mkIf (!isNull cfg.fileTypes) cfg.fileTypes; - mkdp_theme = mkIf (!isNull cfg.theme) cfg.theme; + mkdp_auto_start = mkIf (cfg.autoStart != null) cfg.autoStart; + mkdp_auto_close = mkIf (cfg.autoClose != null) cfg.autoClose; + mkdp_refresh_slow = mkIf (cfg.refreshSlow != null) cfg.refreshSlow; + mkdp_command_for_global = mkIf (cfg.commandForGlobal != null) cfg.commandForGlobal; + mkdp_open_to_the_world = mkIf (cfg.openToTheWorld != null) cfg.openToTheWorld; + mkdp_open_ip = mkIf (cfg.openIp != null) cfg.openIp; + mkdp_browser = mkIf (cfg.browser != null) cfg.browser; + mkdp_echo_preview_url = mkIf (cfg.echoPreviewUrl != null) cfg.echoPreviewUrl; + mkdp_browserfunc = mkIf (cfg.browserFunc != null) cfg.browserFunc; + mkdp_preview_options = mkIf (cfg.previewOptions != null) cfg.previewOptions; + mkdp_markdown_css = mkIf (cfg.markdownCss != null) cfg.markdownCss; + mkdp_highlight_css = mkIf (cfg.highlightCss != null) cfg.highlightCss; + mkdp_port = mkIf (cfg.port != null) cfg.port; + mkdp_page_title = mkIf (cfg.pageTitle != null) cfg.pageTitle; + mkdp_filetypes = mkIf (cfg.fileTypes != null) cfg.fileTypes; + mkdp_theme = mkIf (cfg.theme != null) cfg.theme; }; }; } diff --git a/plugins/languages/nvim-jdtls.nix b/plugins/languages/nvim-jdtls.nix index 3cc4fc7a..3d0dc145 100644 --- a/plugins/languages/nvim-jdtls.nix +++ b/plugins/languages/nvim-jdtls.nix @@ -71,7 +71,7 @@ in { ''; settings = - helpers.mkNullOrOption (types.attrs) + helpers.mkNullOrOption types.attrs '' 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 @@ -79,7 +79,7 @@ in { ''; initOptions = - helpers.mkNullOrOption (types.attrs) + helpers.mkNullOrOption types.attrs '' Language server `initializationOptions` You need to extend the `bundles` with paths to jar files if you want to use additional @@ -93,10 +93,10 @@ in { config = let cmd = - if isNull cfg.cmd + if (cfg.cmd == null) then let data = - if isNull cfg.data + if (cfg.data == null) then throw '' You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd' @@ -109,7 +109,7 @@ in { ] ++ ["-data" data] ++ ( - optionals (!isNull cfg.configuration) + optionals (cfg.configuration != null) ["-configuration" cfg.configuration] ) else cfg.cmd; diff --git a/plugins/languages/openscad.nix b/plugins/languages/openscad.nix index 827e2a1c..43f96749 100644 --- a/plugins/languages/openscad.nix +++ b/plugins/languages/openscad.nix @@ -45,7 +45,7 @@ in { config = let cfg = config.plugins.openscad; fuzzyFinder = - if isNull cfg.fuzzyFinder + if (cfg.fuzzyFinder == null) then defaultFuzzyFinder else cfg.fuzzyFinder; in diff --git a/plugins/languages/sniprun.nix b/plugins/languages/sniprun.nix index e6f7f28e..15f85f00 100644 --- a/plugins/languages/sniprun.nix +++ b/plugins/languages/sniprun.nix @@ -89,7 +89,7 @@ in { "Customize highlight groups (setting this overrides colorscheme)" ( mapAttrs - (optionName: defaults: colorOption defaults) + (optionName: colorOption) { SniprunVirtualTextOk = { bg = "#66eeff"; @@ -131,7 +131,7 @@ in { ++ ( optional ( - (!isNull cfg.display) + (cfg.display != null) && (any (hasPrefix "NvimNotify") cfg.display) ) nvim-notify diff --git a/plugins/languages/tagbar.nix b/plugins/languages/tagbar.nix index ffac2ea7..a696957f 100644 --- a/plugins/languages/tagbar.nix +++ b/plugins/languages/tagbar.nix @@ -27,6 +27,6 @@ in extraPackages = [pkgs.ctags]; - globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig; + globals = mapAttrs' (name: nameValuePair ("tagbar_" + name)) cfg.extraConfig; }; } diff --git a/plugins/languages/treesitter/treesitter-playground.nix b/plugins/languages/treesitter/treesitter-playground.nix index 32d95e3e..b9670c07 100644 --- a/plugins/languages/treesitter/treesitter-playground.nix +++ b/plugins/languages/treesitter/treesitter-playground.nix @@ -58,7 +58,7 @@ in { toggle_language_display = cfg.keybindings.toggleLanguageDisplay; focus_language = cfg.keybindings.focusLanguage; unfocus_language = cfg.keybindings.unfocusLanguage; - update = cfg.keybindings.update; + inherit (cfg.keybindings) update; goto_node = cfg.keybindings.gotoNode; show_help = cfg.keybindings.showHelp; }; diff --git a/plugins/languages/treesitter/treesitter.nix b/plugins/languages/treesitter/treesitter.nix index 37e5559a..8d101610 100644 --- a/plugins/languages/treesitter/treesitter.nix +++ b/plugins/languages/treesitter/treesitter.nix @@ -102,7 +102,7 @@ in { tsOptions = { highlight = { - enable = cfg.enable; + inherit (cfg) enable; disable = if (cfg.disabledLanguages != []) then cfg.disabledLanguages diff --git a/plugins/languages/vimtex.nix b/plugins/languages/vimtex.nix index 6852e045..4c1dc531 100644 --- a/plugins/languages/vimtex.nix +++ b/plugins/languages/vimtex.nix @@ -40,6 +40,6 @@ in # Usefull for inverse search extraPackages = with pkgs; [pstree xdotool]; - globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals; + globals = mapAttrs' (name: nameValuePair ("vimtex_" + name)) globals; }; } diff --git a/plugins/lsp/default.nix b/plugins/lsp/default.nix index dfbf6c81..522f9b33 100644 --- a/plugins/lsp/default.nix +++ b/plugins/lsp/default.nix @@ -114,7 +114,7 @@ in { diagnosticMaps = mapAttrs (key: action: { - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; action = "vim.diagnostic.${action}"; lua = true; }) @@ -123,7 +123,7 @@ in { lspBuf = mapAttrs (key: action: { - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; action = "vim.lsp.buf.${action}"; lua = true; }) diff --git a/plugins/lsp/language-servers/default.nix b/plugins/lsp/language-servers/default.nix index 8b6aba27..59dd76b9 100644 --- a/plugins/lsp/language-servers/default.nix +++ b/plugins/lsp/language-servers/default.nix @@ -212,7 +212,7 @@ with lib; let }; workspace = { library = mkOption { - type = types.nullOr (types.either types.str (helpers.rawType)); + type = types.nullOr (types.either types.str helpers.rawType); description = '' 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. @@ -356,6 +356,6 @@ with lib; let ]; in { imports = - lib.lists.map (lspHelpers.mkLsp) servers + lib.lists.map lspHelpers.mkLsp servers ++ [./pylsp.nix]; } diff --git a/plugins/lsp/language-servers/pylsp.nix b/plugins/lsp/language-servers/pylsp.nix index 50067230..8993b18d 100644 --- a/plugins/lsp/language-servers/pylsp.nix +++ b/plugins/lsp/language-servers/pylsp.nix @@ -16,12 +16,10 @@ in { type = lib.types.nullOr (types.enum ["pycodestyle" "flake8"]); description = "List of configuration sources to use."; default = null; - apply = ( - value: - if (value != null) - then [value] - else null - ); + apply = value: + if (value != null) + then [value] + else null; }; plugins = { @@ -502,8 +500,8 @@ in { mkIf cfg.enable { extraPackages = let - isEnabled = x: (!isNull x) && (x.enabled == true); - plugins = cfg.settings.plugins; + isEnabled = x: (x != null) && (x.enabled != null && x.enabled); + inherit (cfg.settings) plugins; in lists.flatten ( (map diff --git a/plugins/null-ls/default.nix b/plugins/null-ls/default.nix index 541ede80..6b2b3e18 100644 --- a/plugins/null-ls/default.nix +++ b/plugins/null-ls/default.nix @@ -63,7 +63,7 @@ in { 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 `:help vim.diagnostic.config()`. (null-ls uses separate namespaces for each source, so server-wide configuration will not work diff --git a/plugins/null-ls/helpers.nix b/plugins/null-ls/helpers.nix index c14611a4..aa74528d 100644 --- a/plugins/null-ls/helpers.nix +++ b/plugins/null-ls/helpers.nix @@ -59,7 +59,7 @@ plugins.null-ls.sourcesItems = let sourceItem = "${sourceType}.${name}"; withArgs = - if (isNull cfg.withArgs) + if (cfg.withArgs == null) then sourceItem else "${sourceItem}.with ${cfg.withArgs}"; finalString = ''require("null-ls").builtins.${withArgs}''; diff --git a/plugins/null-ls/servers.nix b/plugins/null-ls/servers.nix index 4ebbcdc5..77f7c0e0 100644 --- a/plugins/null-ls/servers.nix +++ b/plugins/null-ls/servers.nix @@ -84,13 +84,12 @@ serverDataFormatted = lib.mapAttrsToList ( - sourceType: sourceSet: - lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet + sourceType: lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) ) serverData; dataFlattened = lib.flatten serverDataFormatted; in { - imports = lib.lists.map (helpers.mkServer) dataFlattened; + imports = lib.lists.map helpers.mkServer dataFlattened; config = let cfg = config.plugins.null-ls; diff --git a/plugins/statuslines/airline.nix b/plugins/statuslines/airline.nix index 9ece4162..9c9c6611 100644 --- a/plugins/statuslines/airline.nix +++ b/plugins/statuslines/airline.nix @@ -71,15 +71,15 @@ in { [ cfg.package ] - ++ optional (!isNull cfg.theme) vim-airline-themes; + ++ optional (cfg.theme != null) vim-airline-themes; globals = { airline.extensions = cfg.extensions; 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; }; diff --git a/plugins/statuslines/lualine.nix b/plugins/statuslines/lualine.nix index ad57f2f0..441735e5 100644 --- a/plugins/statuslines/lualine.nix +++ b/plugins/statuslines/lualine.nix @@ -214,18 +214,16 @@ in { inherit icons_enabled icon separator color padding; } extraConfig; - processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections; + processSections = mapAttrs (_: mapNullable (map processComponent)); setupOptions = { options = { + inherit (cfg) theme globalstatus refresh extensions; icons_enabled = cfg.iconsEnabled; - theme = cfg.theme; section_separators = cfg.sectionSeparators; component_separators = cfg.componentSeparators; disabled_filetypes = cfg.disabledFiletypes; ignore_focus = cfg.ignoreFocus; always_divide_middle = cfg.alwaysDivideMiddle; - globalstatus = cfg.globalstatus; - refresh = cfg.refresh; }; sections = mapNullable processSections cfg.sections; @@ -233,7 +231,6 @@ in { tabline = mapNullable processSections cfg.tabline; winbar = mapNullable processSections cfg.winbar; inactive_winbar = mapNullable processSections cfg.inactiveWinbar; - extensions = cfg.extensions; }; in mkIf cfg.enable { diff --git a/plugins/telescope/default.nix b/plugins/telescope/default.nix index 665fa96e..0c3f0606 100644 --- a/plugins/telescope/default.nix +++ b/plugins/telescope/default.nix @@ -92,7 +92,7 @@ in { options = { extensions = cfg.extensionConfig; - defaults = cfg.defaults; + inherit (cfg) defaults; } // cfg.extraOptions; in '' diff --git a/plugins/telescope/frecency.nix b/plugins/telescope/frecency.nix index 62cb6166..fb4065df 100644 --- a/plugins/telescope/frecency.nix +++ b/plugins/telescope/frecency.nix @@ -56,7 +56,7 @@ in { default_workspace = cfg.defaultWorkspace; ignore_patterns = cfg.ignorePatterns; show_scores = cfg.showScores; - workspaces = cfg.workspaces; + inherit (cfg) workspaces; show_unindexed = cfg.showUnindexed; devicons_disabled = cfg.deviconsDisabled; }; diff --git a/plugins/telescope/fzf-native.nix b/plugins/telescope/fzf-native.nix index c1401040..78a2476e 100644 --- a/plugins/telescope/fzf-native.nix +++ b/plugins/telescope/fzf-native.nix @@ -36,7 +36,7 @@ in { config = let configuration = { - fuzzy = cfg.fuzzy; + inherit (cfg) fuzzy; override_generic_sorter = cfg.overrideGenericSorter; override_file_sorter = cfg.overrideFileSorter; case_mode = cfg.caseMode; diff --git a/plugins/ui/noice.nix b/plugins/ui/noice.nix index 36c7376c..5874fc19 100644 --- a/plugins/ui/noice.nix +++ b/plugins/ui/noice.nix @@ -308,7 +308,7 @@ in { inherit (cfgLP) enabled format throttle view; format_done = cfgLP.formatDone; }; - override = cfgL.override; + inherit (cfgL) override; hover = helpers.ifNonNull' cfgL.hover { inherit (cfgL.hover) enabled view opts; }; diff --git a/plugins/utils/comment-nvim.nix b/plugins/utils/comment-nvim.nix index 04a235c1..5799da97 100644 --- a/plugins/utils/comment-nvim.nix +++ b/plugins/utils/comment-nvim.nix @@ -30,7 +30,7 @@ in { default = null; }; toggler = mkOption { - type = types.nullOr (types.submodule ({...}: { + type = types.nullOr (types.submodule (_: { options = { line = mkOption { type = types.str; @@ -48,7 +48,7 @@ in { default = null; }; opleader = mkOption { - type = types.nullOr (types.submodule ({...}: { + type = types.nullOr (types.submodule (_: { options = { line = mkOption { type = types.str; @@ -66,7 +66,7 @@ in { default = null; }; mappings = mkOption { - type = types.nullOr (types.submodule ({...}: { + type = types.nullOr (types.submodule (_: { options = { basic = mkOption { type = types.bool; @@ -93,12 +93,7 @@ in { config = let setupOptions = { - padding = cfg.padding; - sticky = cfg.sticky; - ignore = cfg.ignore; - toggler = cfg.toggler; - opleader = cfg.opleader; - mappings = cfg.mappings; + inherit (cfg) padding sticky ignore toggler opleader mappings; }; in mkIf cfg.enable { diff --git a/plugins/utils/dashboard.nix b/plugins/utils/dashboard.nix index 50bfdaa3..a4271289 100644 --- a/plugins/utils/dashboard.nix +++ b/plugins/utils/dashboard.nix @@ -127,7 +127,7 @@ in { session_directory = cfg.sessionDirectory; }; - filteredOptions = filterAttrs (_: v: !isNull v) options; + filteredOptions = filterAttrs (_: v: v != null) options; in mkIf cfg.enable { extraPlugins = [cfg.package]; diff --git a/plugins/utils/harpoon.nix b/plugins/utils/harpoon.nix index 38508e6a..6ffb8a56 100644 --- a/plugins/utils/harpoon.nix +++ b/plugins/utils/harpoon.nix @@ -54,11 +54,11 @@ in { }; ''; - navNext = helpers.mkNullOrOption (types.str) '' + navNext = helpers.mkNullOrOption types.str '' Keymap for navigating to next mark."; ''; - navPrev = helpers.mkNullOrOption (types.str) '' + navPrev = helpers.mkNullOrOption types.str '' Keymap for navigating to previous mark."; ''; @@ -171,11 +171,10 @@ in { mark_branch = cfg.markBranch; }; - projects = projects; + inherit projects; menu = { - width = cfg.menu.width; - height = cfg.menu.height; + inherit (cfg.menu) width height; borderchars = cfg.menu.borderChars; }; } @@ -197,13 +196,14 @@ in { ( optionName: luaFunc: let key = km.${optionName}; - in (mkIf (key != null) { - ${key} = { - action = luaFunc; - lua = true; - inherit silent; - }; - }) + in + mkIf (key != null) { + ${key} = { + action = luaFunc; + lua = true; + inherit silent; + }; + } ) { addFile = "require('harpoon.mark').add_file"; diff --git a/plugins/utils/neorg.nix b/plugins/utils/neorg.nix index cd9f6132..5dc3dc8a 100644 --- a/plugins/utils/neorg.nix +++ b/plugins/utils/neorg.nix @@ -118,14 +118,14 @@ in lazy_loading = cfg.lazyLoading; logger = { - plugin = cfg.logger.plugin; + inherit (cfg.logger) plugin; use_console = cfg.logger.useConsole; - highlights = cfg.logger.highlights; + inherit (cfg.logger) highlights; use_file = cfg.logger.useFile; - level = cfg.logger.level; + inherit (cfg.logger) level; modes = - if (isNull cfg.logger.modes) + if (cfg.logger.modes == null) then null else attrsets.mapAttrsToList @@ -133,7 +133,7 @@ in name = mode; inherit (modeConfig) hl; level = let - level = modeConfig.level; + inherit (modeConfig) level; in if (isInt level) then level diff --git a/plugins/utils/notify.nix b/plugins/utils/notify.nix index aaecc0f8..41f1a4d1 100644 --- a/plugins/utils/notify.nix +++ b/plugins/utils/notify.nix @@ -54,8 +54,7 @@ in { config = let setupOptions = with cfg; { - stages = stages; - timeout = timeout; + inherit stages timeout; background_colour = backgroundColour; minimum_width = minimumWidth; icons = with icons; { diff --git a/plugins/utils/nvim-autopairs.nix b/plugins/utils/nvim-autopairs.nix index 58625774..d4c75630 100644 --- a/plugins/utils/nvim-autopairs.nix +++ b/plugins/utils/nvim-autopairs.nix @@ -101,7 +101,7 @@ in { mkIf cfg.enable { extraPlugins = [cfg.package]; - plugins.treesitter.enable = mkIf (cfg.checkTs == true) true; + plugins.treesitter.enable = mkIf (cfg.checkTs != null && cfg.checkTs) true; extraConfigLua = '' require('nvim-autopairs').setup(${helpers.toLuaObject options}) diff --git a/plugins/utils/nvim-bqf.nix b/plugins/utils/nvim-bqf.nix index 231a3a65..4a9b3f8b 100644 --- a/plugins/utils/nvim-bqf.nix +++ b/plugins/utils/nvim-bqf.nix @@ -136,7 +136,7 @@ in { inherit wrap; buf_label = bufLabel; should_preview_cb = - if isNull shouldPreviewCb + if (shouldPreviewCb == null) then null else helpers.mkRaw shouldPreviewCb; }; diff --git a/plugins/utils/nvim-osc52.nix b/plugins/utils/nvim-osc52.nix index a438088b..c7bf9e95 100644 --- a/plugins/utils/nvim-osc52.nix +++ b/plugins/utils/nvim-osc52.nix @@ -61,19 +61,19 @@ in action = "require('osc52').copy_operator"; expr = true; lua = true; - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; }; "${cfg.keymaps.copyLine}" = { action = "${cfg.keymaps.copy}_"; remap = true; - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; }; }; visual = { "${cfg.keymaps.copyVisual}" = { action = "require('osc52').copy_visual"; lua = true; - silent = cfg.keymaps.silent; + inherit (cfg.keymaps) silent; }; }; }; diff --git a/plugins/utils/presence-nvim.nix b/plugins/utils/presence-nvim.nix index 46b8f123..97177161 100644 --- a/plugins/utils/presence-nvim.nix +++ b/plugins/utils/presence-nvim.nix @@ -161,10 +161,10 @@ in { log_level = cfg.logLevel; debounce_timeout = cfg.debounceTimeout; enable_line_number = cfg.enableLineNumber; - blacklist = cfg.blacklist; + inherit (cfg) blacklist; file_assets = cfg.fileAssets; show_time = cfg.showTime; - buttons = cfg.buttons; + inherit (cfg) buttons; # Rich presence text options. editing_text = cfg.editingText; diff --git a/plugins/utils/project-nvim.nix b/plugins/utils/project-nvim.nix index b19574f2..a255d8c2 100644 --- a/plugins/utils/project-nvim.nix +++ b/plugins/utils/project-nvim.nix @@ -66,7 +66,7 @@ in { { manual_mode = cfg.manualMode; detection_methods = cfg.detectionMethods; - patterns = cfg.patterns; + inherit (cfg) patterns; ignore_lsp = cfg.ignoreLsp; exclude_dirs = cfg.excludeDirs; show_hidden = cfg.showHidden; diff --git a/plugins/utils/specs.nix b/plugins/utils/specs.nix index 907abe62..77b179bc 100644 --- a/plugins/utils/specs.nix +++ b/plugins/utils/specs.nix @@ -129,7 +129,7 @@ in { popup = { inherit (cfg) blend width; winhl = - if (!isNull cfg.color) + if (cfg.color != null) then "SpecsPopColor" else "PMenu"; delay_ms = cfg.delay; @@ -150,7 +150,7 @@ in { mkIf cfg.enable { extraPlugins = [cfg.package]; - highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color; + highlight.SpecsPopColor.bg = mkIf (cfg.color != null) cfg.color; extraConfigLua = '' require('specs').setup(${setup}) diff --git a/plugins/utils/todo-comments.nix b/plugins/utils/todo-comments.nix index df442424..a7e5e7dd 100644 --- a/plugins/utils/todo-comments.nix +++ b/plugins/utils/todo-comments.nix @@ -222,9 +222,9 @@ in { config = let setupOptions = { - signs = cfg.signs; + inherit (cfg) signs; sign_priority = cfg.signPriority; - keywords = cfg.keywords; + inherit (cfg) keywords; gui_style = cfg.guiStyle; merge_keywords = cfg.mergeKeywords; highlight = helpers.ifNonNull' cfg.highlight { @@ -244,14 +244,14 @@ in { comments_only = cfg.highlight.commentsOnly; max_line_len = cfg.highlight.maxLineLen; }; - colors = cfg.colors; + inherit (cfg) colors; search = helpers.ifNonNull' cfg.search { inherit (cfg.search) command args; pattern = helpers.ifNonNull' 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}]]" ); }; @@ -266,7 +266,7 @@ in { maps.normal = let silent = cfg.keymapsSilent; - keymaps = cfg.keymaps; + inherit (cfg) keymaps; in mkMerge ( mapAttrsToList @@ -274,25 +274,26 @@ in { optionName: funcName: let keymap = keymaps.${optionName}; - key = keymap.key; + inherit (keymap) key; - cwd = optionalString (!isNull keymap.cwd) " cwd=${keymap.cwd}"; - keywords = optionalString (!isNull keymap.keywords) " keywords=${keymap.keywords}"; + cwd = optionalString (keymap.cwd != null) " cwd=${keymap.cwd}"; + keywords = optionalString (keymap.keywords != null) " keywords=${keymap.keywords}"; action = ":${funcName}${cwd}${keywords}"; - in (mkIf (keymap != null) { - ${key} = { - inherit silent action; - }; - }) + in + mkIf (keymap != null) { + ${key} = { + inherit silent action; + }; + } ) commands ); # Automatically enable plugins if keymaps have been set plugins = mkMerge [ - (mkIf (!isNull cfg.keymaps.todoTrouble) {trouble.enable = true;}) - (mkIf (!isNull cfg.keymaps.todoTelescope) {telescope.enable = true;}) + (mkIf (cfg.keymaps.todoTrouble != null) {trouble.enable = true;}) + (mkIf (cfg.keymaps.todoTelescope != null) {telescope.enable = true;}) ]; }; } diff --git a/plugins/utils/vim-bbye.nix b/plugins/utils/vim-bbye.nix index cb718f35..37c41956 100644 --- a/plugins/utils/vim-bbye.nix +++ b/plugins/utils/vim-bbye.nix @@ -34,14 +34,14 @@ in { extraPlugins = [cfg.package]; maps.normal = with cfg.keymaps; - (optionalAttrs (!isNull bdelete) + (optionalAttrs (bdelete != null) { ${bdelete} = { action = ":Bdelete"; silent = cfg.keymapsSilent; }; }) - // (optionalAttrs (!isNull bwipeout) + // (optionalAttrs (bwipeout != null) { ${bwipeout} = { action = ":Bwipeout"; diff --git a/tests/default.nix b/tests/default.nix index f98ec6ee..e27e41ee 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -5,7 +5,7 @@ }: let fetchTests = import ./fetch-tests.nix; test-derivation = import ./test-derivation.nix {inherit pkgs makeNixvim;}; - mkTestDerivation = test-derivation.mkTestDerivation; + inherit (test-derivation) mkTestDerivation; # List of files containing configurations testFiles = fetchTests { diff --git a/tests/fetch-tests.nix b/tests/fetch-tests.nix index 893e10b6..55b76278 100644 --- a/tests/fetch-tests.nix +++ b/tests/fetch-tests.nix @@ -61,7 +61,7 @@ cases; # 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' in concatMany (builtins.map handleTestFile testsListEvaluated) diff --git a/tests/test-derivation.nix b/tests/test-derivation.nix index c43ac897..e42a37d3 100644 --- a/tests/test-derivation.nix +++ b/tests/test-derivation.nix @@ -11,7 +11,7 @@ ... }: pkgs.stdenv.mkDerivation { - name = name; + inherit name; nativeBuildInputs = [nvim pkgs.docker-client]; diff --git a/wrappers/darwin.nix b/wrappers/darwin.nix index 1ae99c0f..5a3290c6 100644 --- a/wrappers/darwin.nix +++ b/wrappers/darwin.nix @@ -27,8 +27,7 @@ in { environment.systemPackages = [cfg.finalPackage]; } { - warnings = cfg.warnings; - assertions = cfg.assertions; + inherit (cfg) warnings assertions; } ]); } diff --git a/wrappers/hm.nix b/wrappers/hm.nix index 6c1a0bab..f8bb2223 100644 --- a/wrappers/hm.nix +++ b/wrappers/hm.nix @@ -34,8 +34,7 @@ in { xdg.configFile = files; }) { - warnings = cfg.warnings; - assertions = cfg.assertions; + inherit (cfg) warnings assertions; } ]); } diff --git a/wrappers/modules/files.nix b/wrappers/modules/files.nix index 7edc5509..5e604e4a 100644 --- a/wrappers/modules/files.nix +++ b/wrappers/modules/files.nix @@ -44,9 +44,9 @@ in { }; config = let - files = config.files; + inherit (config) files; concatFilesOption = attr: - lib.flatten (lib.mapAttrsToList (_: file: builtins.getAttr attr file) files); + lib.flatten (lib.mapAttrsToList (_: builtins.getAttr attr) files); in { # Each file can declare plugins/packages/warnings/assertions extraPlugins = concatFilesOption "extraPlugins"; @@ -59,7 +59,7 @@ in { name = "nixvim-config"; paths = (lib.mapAttrsToList (_: file: file.plugin) files) - ++ (lib.mapAttrsToList (path: content: pkgs.writeTextDir path content) config.extraFiles); + ++ (lib.mapAttrsToList pkgs.writeTextDir config.extraFiles); }; }; } diff --git a/wrappers/modules/output.nix b/wrappers/modules/output.nix index d2fb042a..9c25ee78 100644 --- a/wrappers/modules/output.nix +++ b/wrappers/modules/output.nix @@ -113,7 +113,7 @@ in { extraWrapperArgs = builtins.concatStringsSep " " ( (optional (config.extraPackages != []) ''--prefix PATH : "${makeBinPath config.extraPackages}"'') - ++ (optional (config.wrapRc) + ++ (optional config.wrapRc ''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'') ); diff --git a/wrappers/nixos.nix b/wrappers/nixos.nix index 1e73af5c..a6c6ce3d 100644 --- a/wrappers/nixos.nix +++ b/wrappers/nixos.nix @@ -35,8 +35,7 @@ in { environment.variables."VIM" = "/etc/nvim"; }) { - warnings = cfg.warnings; - assertions = cfg.assertions; + inherit (cfg) warnings assertions; } ]); }