treewide: format with new nixfmt

This commit is contained in:
Gaetan Lepage 2025-07-25 18:16:52 +02:00 committed by Gaétan Lepage
parent d63fd77511
commit dd73afe9c6
34 changed files with 665 additions and 679 deletions

View file

@ -12,32 +12,31 @@
}; };
# Public `lib` flake output # Public `lib` flake output
flake.lib = flake.lib = {
{ nixvim = lib.makeOverridable (import ../lib) {
nixvim = lib.makeOverridable (import ../lib) { inherit lib;
inherit lib; flake = self;
flake = self; };
}; overlay = lib.makeOverridable (import ../lib/overlay.nix) {
overlay = lib.makeOverridable (import ../lib/overlay.nix) { flake = self;
flake = self; };
}; # Top-top-level aliases
# Top-top-level aliases inherit (self.lib.nixvim)
inherit (self.lib.nixvim) evalNixvim
evalNixvim ;
; }
} // lib.genAttrs config.systems (
// lib.genAttrs config.systems ( lib.flip withSystem (
lib.flip withSystem ( { pkgs, system, ... }:
{ pkgs, system, ... }: {
{ # NOTE: this is the publicly documented flake output we've had for a while
# NOTE: this is the publicly documented flake output we've had for a while check = pkgs.callPackage ../lib/tests.nix {
check = pkgs.callPackage ../lib/tests.nix { inherit lib self system;
inherit lib self system; };
};
# NOTE: no longer needs to be per-system # NOTE: no longer needs to be per-system
helpers = lib.warn "nixvim: `<nixvim>.lib.${system}.helpers` has been moved to `<nixvim>.lib.nixvim` and no longer depends on a specific system" self.lib.nixvim; helpers = lib.warn "nixvim: `<nixvim>.lib.${system}.helpers` has been moved to `<nixvim>.lib.nixvim` and no longer depends on a specific system" self.lib.nixvim;
} }
) )
); );
} }

View file

@ -50,7 +50,8 @@ in
modulesPath = ../modules; modulesPath = ../modules;
# TODO: deprecate `helpers` # TODO: deprecate `helpers`
helpers = self; helpers = self;
} // extraSpecialArgs; }
// extraSpecialArgs;
}; };
} }
// lib.mapAttrs ( // lib.mapAttrs (

View file

@ -49,20 +49,19 @@
warnings = warnings =
let let
# All keymap options that have historically supported the `lua` sub-option # All keymap options that have historically supported the `lua` sub-option
keymapOptions = keymapOptions = [
[ options.keymaps
options.keymaps options.keymapsOnEvents
options.keymapsOnEvents options.plugins.wtf.keymaps.ai
options.plugins.wtf.keymaps.ai options.plugins.wtf.keymaps.search
options.plugins.wtf.keymaps.search # NOTE: lsp `diagnostic` and `lspBuf` don't use `mapOptionSubmodule` yet
# NOTE: lsp `diagnostic` and `lspBuf` don't use `mapOptionSubmodule` yet # So we only need `lua` deprecation in lsp's `extra` option
# So we only need `lua` deprecation in lsp's `extra` option options.plugins.lsp.keymaps.extra
options.plugins.lsp.keymaps.extra # NOTE: tmux-navigator added `mapOptionSubmodule` support _after_ branching off 24.05
# NOTE: tmux-navigator added `mapOptionSubmodule` support _after_ branching off 24.05 options.plugins.tmux-navigator.keymaps
options.plugins.tmux-navigator.keymaps ]
] # NOTE: barbar added `mapOptionSubmodule` support shortly _before_ branching off 24.05
# NOTE: barbar added `mapOptionSubmodule` support shortly _before_ branching off 24.05 ++ builtins.attrValues (builtins.removeAttrs options.plugins.barbar.keymaps [ "silent" ]);
++ builtins.attrValues (builtins.removeAttrs options.plugins.barbar.keymaps [ "silent" ]);
in in
lib.pipe keymapOptions [ lib.pipe keymapOptions [
(map (opt: (opt.type.getSubOptions opt.loc).lua)) (map (opt: (opt.type.getSubOptions opt.loc).lua))

View file

@ -6,10 +6,11 @@ let
by-name = ../plugins/by-name; by-name = ../plugins/by-name;
in in
{ {
imports = imports = [
[ ../plugins ] ../plugins
++ foldlAttrs ( ]
prev: name: type: ++ foldlAttrs (
prev ++ optional (type == "directory") (by-name + "/${name}") prev: name: type:
) [ ] (readDir by-name); prev ++ optional (type == "directory") (by-name + "/${name}")
) [ ] (readDir by-name);
} }

View file

@ -7,79 +7,78 @@ let
]; ];
in in
{ {
imports = imports = [
[ (mkRemovedOptionModule (basePluginPath ++ [ "server" ]) ''
(mkRemovedOptionModule (basePluginPath ++ [ "server" ]) '' To configure the `clangd` language server options, please use
To configure the `clangd` language server options, please use `plugins.lsp.servers.clangd.extraSettings`.
`plugins.lsp.servers.clangd.extraSettings`. '')
'') (mkRemovedOptionModule (
(mkRemovedOptionModule ( basePluginPath
basePluginPath ++ [
++ [ "extensions"
"extensions" "autoSetHints"
"autoSetHints"
]
) "")
]
++ (map
(
optionPath:
mkRenamedOptionModule (basePluginPath ++ [ "extensions" ] ++ optionPath) (
basePluginPath ++ optionPath
)
)
[
[
"inlayHints"
"inline"
]
[
"inlayHints"
"onlyCurrentLine"
]
[
"inlayHints"
"onlyCurrentLineAutocmd"
]
[
"inlayHints"
"showParameterHints"
]
[
"inlayHints"
"parameterHintsPrefix"
]
[
"inlayHints"
"otherHintsPrefix"
]
[
"inlayHints"
"maxLenAlign"
]
[
"inlayHints"
"maxLenAlignPadding"
]
[
"inlayHints"
"rightAlign"
]
[
"inlayHints"
"rightAlignPadding"
]
[
"inlayHints"
"highlight"
]
[
"inlayHints"
"priority"
]
[ "ast" ]
[ "memoryUsage" ]
[ "symbolInfo" ]
] ]
); ) "")
]
++ (map
(
optionPath:
mkRenamedOptionModule (basePluginPath ++ [ "extensions" ] ++ optionPath) (
basePluginPath ++ optionPath
)
)
[
[
"inlayHints"
"inline"
]
[
"inlayHints"
"onlyCurrentLine"
]
[
"inlayHints"
"onlyCurrentLineAutocmd"
]
[
"inlayHints"
"showParameterHints"
]
[
"inlayHints"
"parameterHintsPrefix"
]
[
"inlayHints"
"otherHintsPrefix"
]
[
"inlayHints"
"maxLenAlign"
]
[
"inlayHints"
"maxLenAlignPadding"
]
[
"inlayHints"
"rightAlign"
]
[
"inlayHints"
"rightAlignPadding"
]
[
"inlayHints"
"highlight"
]
[
"inlayHints"
"priority"
]
[ "ast" ]
[ "memoryUsage" ]
[ "symbolInfo" ]
]
);
} }

View file

@ -6,9 +6,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
maintainers = [ lib.maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
imports = imports = [
[ { cmpSourcePlugins.crates = "crates"; } ] { cmpSourcePlugins.crates = "crates"; }
++ ]
++
# TODO introduced 2024-12-12: remove after 25.05 # TODO introduced 2024-12-12: remove after 25.05
lib.nixvim.mkSettingsRenamedOptionModules [ "plugins" "crates-nvim" ] lib.nixvim.mkSettingsRenamedOptionModules [ "plugins" "crates-nvim" ]
[ "plugins" "crates" ] [ "plugins" "crates" ]

View file

@ -78,23 +78,22 @@ lib.nixvim.plugins.mkNeovimPlugin {
plugins.dap = { plugins.dap = {
enable = true; enable = true;
extensionConfigLua = extensionConfigLua = ''
'' require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject cfg.settings})
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject cfg.settings}) ''
'' + (optionalString (cfg.testRunners != null) ''
+ (optionalString (cfg.testRunners != null) '' table.insert(require("dap-python").test_runners,
table.insert(require("dap-python").test_runners, ${toLuaObject (builtins.mapAttrs (_: lib.nixvim.mkRaw) cfg.testRunners)})
${toLuaObject (builtins.mapAttrs (_: lib.nixvim.mkRaw) cfg.testRunners)}) '')
'') + (optionalString (cfg.customConfigurations != null) ''
+ (optionalString (cfg.customConfigurations != null) '' table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations}) '')
'') + (optionalString (cfg.resolvePython != null) ''
+ (optionalString (cfg.resolvePython != null) '' require("dap-python").resolve_python = ${toLuaObject cfg.resolvePython}
require("dap-python").resolve_python = ${toLuaObject cfg.resolvePython} '')
'') + (optionalString (cfg.testRunner != null) ''
+ (optionalString (cfg.testRunner != null) '' require("dap-python").test_runner = ${toLuaObject cfg.testRunner};
require("dap-python").test_runner = ${toLuaObject cfg.testRunner}; '');
'');
}; };
}; };

View file

@ -34,7 +34,8 @@ rec {
The filetype to use for content retrieved via a source request. The filetype to use for content retrieved via a source request.
''; '';
}; };
} // attrs; }
// attrs;
}; };
executableAdapterOption = mkAdapterType { executableAdapterOption = mkAdapterType {

View file

@ -78,7 +78,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
DapStopped = dapStopped; DapStopped = dapStopped;
DapBreakpointRejected = dapBreakpointRejected; DapBreakpointRejected = dapBreakpointRejected;
}; };
} // cfg.settings; }
// cfg.settings;
in in
{ {
plugins.dap.luaConfig.content = lib.mkMerge [ plugins.dap.luaConfig.content = lib.mkMerge [

View file

@ -190,7 +190,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
action = "Telescope find_files cwd="; action = "Telescope find_files cwd=";
``` ```
''; '';
} // extraOptions; }
// extraOptions;
}; };
in in
{ {

View file

@ -15,23 +15,23 @@ lib.nixvim.plugins.mkVimPlugin {
maintainers = [ lib.maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
# TODO: Added 2024-12-16; remove after 25.05 # TODO: Added 2024-12-16; remove after 25.05
optionsRenamedToSettings = optionsRenamedToSettings = [
[ "autoclose"
"autoclose" "autohide"
"autohide" "autoinsert"
"autoinsert" "borderchars"
"borderchars" "giteditor"
"giteditor" "height"
"height" "opener"
"opener" "position"
"position" "rootmarkers"
"rootmarkers" "shell"
"shell" "title"
"title" "width"
"width" "wintype"
"wintype" ]
] ++
++ map map
(name: { (name: {
old = [ old = [
"keymaps" "keymaps"

View file

@ -70,210 +70,209 @@ lib.nixvim.plugins.mkVimPlugin {
]; ];
}; };
settingsOptions = settingsOptions = {
{ preview_win_location = defaultNullOpts.mkEnumFirstDefault [ "bo" "to" "bel" "abo" ] ''
preview_win_location = defaultNullOpts.mkEnumFirstDefault [ "bo" "to" "bel" "abo" ] '' This option determines where the preview window pops up as a result of the
This option determines where the preview window pops up as a result of the `:GitGutterPreviewHunk` command.
`:GitGutterPreviewHunk` command.
See the end of the `|opening-window|` docs. See the end of the `|opening-window|` docs.
''; '';
git_executable = defaultNullOpts.mkStr' { git_executable = defaultNullOpts.mkStr' {
pluginDefault = "git"; pluginDefault = "git";
example = lib.literalExpression "lib.getExe pkgs.git"; example = lib.literalExpression "lib.getExe pkgs.git";
description = '' description = ''
This option determines what `git` binary to use. This option determines what `git` binary to use.
Set this if git is not on your path. Set this if git is not on your path.
'';
};
git_args = defaultNullOpts.mkStr' {
pluginDefault = "";
example = ''--gitdir=""'';
description = ''
Use this option to pass any extra arguments to `git` when running `git-diff`.
'';
};
diff_args = defaultNullOpts.mkStr' {
pluginDefault = "";
example = "-w";
description = ''
Use this option to pass any extra arguments to `git-diff`.
'';
};
diff_relative_to = defaultNullOpts.mkStr' {
pluginDefault = "index";
example = "working_tree";
description = ''
By default buffers are diffed against the index.
Use this option to diff against the working tree.
'';
};
diff_base = defaultNullOpts.mkStr' {
pluginDefault = "";
example = "";
description = ''
By default buffers are diffed against the index.
Use this option to diff against a revision instead.
If you are looking at a previous version of a file with _Fugitive_ (e.g. via `:0Gclog`),
gitgutter sets the diff base to the parent of the current revision.
This setting is ignore when the diff is relative to the working tree (`diff_relative_to`).
'';
};
grep = defaultNullOpts.mkStr' {
pluginDefault = "grep";
example = "grep --color=never";
description = ''
The plugin pipes the output of `git-diff` into `grep` to minimise the amount of data vim has
to process.
Set this option if `grep` is not on your path.
`grep` must produce plain-text output without any ANSI escape codes or colours.
Use this option to turn off colours if necessary (`grep --color=never` for example).
If you do not want to use `grep` at all (perhaps to debug why signs are not showing), set
this option to an empty string.
'';
};
signs = defaultNullOpts.mkBool true ''
Determines whether or not to show signs.
'';
highlight_lines = defaultNullOpts.mkBool false ''
Determines whether or not to show line highlights.
'';
highlight_linenrs = defaultNullOpts.mkBool false ''
Determines whether or not to show line number highlights.
'';
max_signs = defaultNullOpts.mkInt (-1) ''
Sets the maximum number of signs to show in a buffer.
To avoid slowing down the GUI the number of signs can be capped.
When the number of changed lines exceeds this value, the plugin removes all signs and displays
a warning message.
When set to `-1` the limit is not applied.
'';
sign_priority = defaultNullOpts.mkUnsignedInt 10 ''
Sets the `|sign-priority|` gitgutter assigns to its signs.
'';
sign_allow_clobber = defaultNullOpts.mkBool true ''
Determines whether gitgutter preserves non-gitgutter signs.
When `true`, gitgutter will not preserve non-gitgutter signs.
'';
}
// (lib.mapAttrs'
(n: default: {
name = "sign_${n}";
value = defaultNullOpts.mkStr default ''
Icon for the _${n}_ sign.
You can use unicode characters but not images.
Signs must not take up more than 2 columns.
'';
})
{
added = "+";
modified = "~";
removed = "_";
removed_first_line = "";
removed_above_and_below = "_¯";
modified_removed = "~_";
}
)
// {
set_sign_backgrounds = defaultNullOpts.mkBool false ''
Only applies to existing `GitGutter*` highlight groups.
See `|gitgutter-highlights|`.
Controls whether to override the signs' background colours to match the `|hl-SignColumn|`.
'';
preview_win_floating = defaultNullOpts.mkBool true ''
Whether to use floating/popup windows for hunk previews.
Note that if you use popup windows on Vim you will not be able to stage partial hunks via
the preview window.
'';
floating_window_options =
defaultNullOpts.mkAttrsOf types.anything
{
relative = "cursor";
row = 1;
col = 0;
width = 42;
height = "&previewheight";
style = "minimal";
}
''
This dictionary is passed directly to `|nvim_open_win()|`.
'';
close_preview_on_escape = defaultNullOpts.mkBool false ''
Whether pressing <Esc> in a preview window closes it.
'';
terminal_reports_focus = defaultNullOpts.mkBool true ''
Normally the plugin uses `|FocusGained|` to force-update all buffers when Vim receives
focus.
However some terminals do not report focus events and so the `|FocusGained|` autocommand
never fires.
If this applies to you, either install something like
[Terminus](https://github.com/wincent/terminus) to make `|FocusGained|` work or set this
option to `false`.
If you use `tmux`, try this in your tmux.conf:
```
set -g focus-events on
```
When this option is `false`, the plugin force-updates the buffer on `|BufEnter|` (instead of
only updating if the buffer's contents has changed since the last update).
'';
enabled = defaultNullOpts.mkBool true ''
Controls whether or not the plugin is on at startup.
'';
map_keys = defaultNullOpts.mkBool true ''
Controls whether or not the plugin provides mappings.
See `|gitgutter-mappings|`.
'';
async = defaultNullOpts.mkBool true ''
Controls whether or not diffs are run in the background.
'';
log = defaultNullOpts.mkBool false ''
When switched on, the plugin logs to `gitgutter.log` in the directory where it is installed.
Additionally it logs channel activity to `channel.log`.
'';
use_location_list = defaultNullOpts.mkBool false ''
When switched on, the `:GitGutterQuickFix` command populates the location list of the
current window instead of the global quickfix list.
'';
show_msg_on_hunk_jumping = defaultNullOpts.mkBool true ''
When switched on, a message like "Hunk 4 of 11" is shown on hunk jumping.
''; '';
}; };
git_args = defaultNullOpts.mkStr' {
pluginDefault = "";
example = ''--gitdir=""'';
description = ''
Use this option to pass any extra arguments to `git` when running `git-diff`.
'';
};
diff_args = defaultNullOpts.mkStr' {
pluginDefault = "";
example = "-w";
description = ''
Use this option to pass any extra arguments to `git-diff`.
'';
};
diff_relative_to = defaultNullOpts.mkStr' {
pluginDefault = "index";
example = "working_tree";
description = ''
By default buffers are diffed against the index.
Use this option to diff against the working tree.
'';
};
diff_base = defaultNullOpts.mkStr' {
pluginDefault = "";
example = "";
description = ''
By default buffers are diffed against the index.
Use this option to diff against a revision instead.
If you are looking at a previous version of a file with _Fugitive_ (e.g. via `:0Gclog`),
gitgutter sets the diff base to the parent of the current revision.
This setting is ignore when the diff is relative to the working tree (`diff_relative_to`).
'';
};
grep = defaultNullOpts.mkStr' {
pluginDefault = "grep";
example = "grep --color=never";
description = ''
The plugin pipes the output of `git-diff` into `grep` to minimise the amount of data vim has
to process.
Set this option if `grep` is not on your path.
`grep` must produce plain-text output without any ANSI escape codes or colours.
Use this option to turn off colours if necessary (`grep --color=never` for example).
If you do not want to use `grep` at all (perhaps to debug why signs are not showing), set
this option to an empty string.
'';
};
signs = defaultNullOpts.mkBool true ''
Determines whether or not to show signs.
'';
highlight_lines = defaultNullOpts.mkBool false ''
Determines whether or not to show line highlights.
'';
highlight_linenrs = defaultNullOpts.mkBool false ''
Determines whether or not to show line number highlights.
'';
max_signs = defaultNullOpts.mkInt (-1) ''
Sets the maximum number of signs to show in a buffer.
To avoid slowing down the GUI the number of signs can be capped.
When the number of changed lines exceeds this value, the plugin removes all signs and displays
a warning message.
When set to `-1` the limit is not applied.
'';
sign_priority = defaultNullOpts.mkUnsignedInt 10 ''
Sets the `|sign-priority|` gitgutter assigns to its signs.
'';
sign_allow_clobber = defaultNullOpts.mkBool true ''
Determines whether gitgutter preserves non-gitgutter signs.
When `true`, gitgutter will not preserve non-gitgutter signs.
'';
}
// (lib.mapAttrs'
(n: default: {
name = "sign_${n}";
value = defaultNullOpts.mkStr default ''
Icon for the _${n}_ sign.
You can use unicode characters but not images.
Signs must not take up more than 2 columns.
'';
})
{
added = "+";
modified = "~";
removed = "_";
removed_first_line = "";
removed_above_and_below = "_¯";
modified_removed = "~_";
}
)
// {
set_sign_backgrounds = defaultNullOpts.mkBool false ''
Only applies to existing `GitGutter*` highlight groups.
See `|gitgutter-highlights|`.
Controls whether to override the signs' background colours to match the `|hl-SignColumn|`.
'';
preview_win_floating = defaultNullOpts.mkBool true ''
Whether to use floating/popup windows for hunk previews.
Note that if you use popup windows on Vim you will not be able to stage partial hunks via
the preview window.
'';
floating_window_options =
defaultNullOpts.mkAttrsOf types.anything
{
relative = "cursor";
row = 1;
col = 0;
width = 42;
height = "&previewheight";
style = "minimal";
}
''
This dictionary is passed directly to `|nvim_open_win()|`.
'';
close_preview_on_escape = defaultNullOpts.mkBool false ''
Whether pressing <Esc> in a preview window closes it.
'';
terminal_reports_focus = defaultNullOpts.mkBool true ''
Normally the plugin uses `|FocusGained|` to force-update all buffers when Vim receives
focus.
However some terminals do not report focus events and so the `|FocusGained|` autocommand
never fires.
If this applies to you, either install something like
[Terminus](https://github.com/wincent/terminus) to make `|FocusGained|` work or set this
option to `false`.
If you use `tmux`, try this in your tmux.conf:
```
set -g focus-events on
```
When this option is `false`, the plugin force-updates the buffer on `|BufEnter|` (instead of
only updating if the buffer's contents has changed since the last update).
'';
enabled = defaultNullOpts.mkBool true ''
Controls whether or not the plugin is on at startup.
'';
map_keys = defaultNullOpts.mkBool true ''
Controls whether or not the plugin provides mappings.
See `|gitgutter-mappings|`.
'';
async = defaultNullOpts.mkBool true ''
Controls whether or not diffs are run in the background.
'';
log = defaultNullOpts.mkBool false ''
When switched on, the plugin logs to `gitgutter.log` in the directory where it is installed.
Additionally it logs channel activity to `channel.log`.
'';
use_location_list = defaultNullOpts.mkBool false ''
When switched on, the `:GitGutterQuickFix` command populates the location list of the
current window instead of the global quickfix list.
'';
show_msg_on_hunk_jumping = defaultNullOpts.mkBool true ''
When switched on, a message like "Hunk 4 of 11" is shown on hunk jumping.
'';
};
settingsExample = { settingsExample = {
set_sign_backgrounds = true; set_sign_backgrounds = true;
sign_modified_removed = "*"; sign_modified_removed = "*";

View file

@ -65,15 +65,14 @@ lib.nixvim.plugins.mkVimPlugin {
}; };
extraOptions = { extraOptions = {
keymaps = keymaps = {
{ silent = mkOption {
silent = mkOption { type = types.bool;
type = types.bool; description = "Whether julia-cell keymaps should be silent";
description = "Whether julia-cell keymaps should be silent"; default = false;
default = false; };
}; }
} // (mapAttrs (name: value: helpers.mkNullOrOption types.str "Keymap for ${value.desc}.") mappings);
// (mapAttrs (name: value: helpers.mkNullOrOption types.str "Keymap for ${value.desc}.") mappings);
}; };
extraConfig = cfg: { extraConfig = cfg: {

View file

@ -214,39 +214,38 @@ lib.nixvim.plugins.mkNeovimPlugin {
extraConfig = cfg: { extraConfig = cfg: {
autoCmd = lib.optionals (cfg.autoCmd != null) [ cfg.autoCmd ]; autoCmd = lib.optionals (cfg.autoCmd != null) [ cfg.autoCmd ];
plugins.lint.luaConfig.content = plugins.lint.luaConfig.content = ''
'' local __lint = require('lint')
local __lint = require('lint') ''
'' + (lib.optionalString (cfg.lintersByFt != null) ''
+ (lib.optionalString (cfg.lintersByFt != null) '' __lint.linters_by_ft = ${toLuaObject cfg.lintersByFt}
__lint.linters_by_ft = ${toLuaObject cfg.lintersByFt} '')
'') + (lib.optionalString (cfg.customLinters != null) (
+ (lib.optionalString (cfg.customLinters != null) ( lib.concatLines (
lib.concatLines ( lib.mapAttrsToList (
customLinter: linterConfig:
let
linterConfig' =
if builtins.isString linterConfig then lib.nixvim.mkRaw linterConfig else linterConfig;
in
"__lint.linters.${customLinter} = ${toLuaObject linterConfig'}"
) cfg.customLinters
)
))
+ (lib.optionalString (cfg.linters != null) (
lib.concatLines (
lib.flatten (
lib.mapAttrsToList ( lib.mapAttrsToList (
customLinter: linterConfig: linter: linterConfig:
let
linterConfig' =
if builtins.isString linterConfig then lib.nixvim.mkRaw linterConfig else linterConfig;
in
"__lint.linters.${customLinter} = ${toLuaObject linterConfig'}"
) cfg.customLinters
)
))
+ (lib.optionalString (cfg.linters != null) (
lib.concatLines (
lib.flatten (
lib.mapAttrsToList ( lib.mapAttrsToList (
linter: linterConfig: propName: propValue:
lib.mapAttrsToList ( lib.optionalString (
propName: propValue: propValue != null
lib.optionalString ( ) "__lint.linters.${linter}.${propName} = ${toLuaObject propValue}"
propValue != null ) linterConfig
) "__lint.linters.${linter}.${propName} = ${toLuaObject propValue}" ) cfg.linters
) linterConfig
) cfg.linters
)
) )
)); )
));
}; };
} }

View file

@ -54,22 +54,21 @@ in
config = config =
let let
doCmp = cfg.cmp.enable && config.plugins.cmp.enable; doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
options = options = {
{ inherit (cfg) mode preset;
inherit (cfg) mode preset; symbol_map = cfg.symbolMap;
symbol_map = cfg.symbolMap; }
} // (
// ( if doCmp then
if doCmp then {
{ maxwidth = cfg.cmp.maxWidth;
maxwidth = cfg.cmp.maxWidth; ellipsis_char = cfg.cmp.ellipsisChar;
ellipsis_char = cfg.cmp.ellipsisChar; inherit (cfg.cmp) menu;
inherit (cfg.cmp) menu; }
} else
else { }
{ } )
) // cfg.extraOptions;
// cfg.extraOptions;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -12,46 +12,45 @@ lib.nixvim.plugins.mkNeovimPlugin {
# TODO introduced 2024-02-29: remove 2024-04-29 # TODO introduced 2024-02-29: remove 2024-04-29
deprecateExtraOptions = true; deprecateExtraOptions = true;
imports = imports = [
# TODO: added 2025-04-07, remove after 25.05
(lib.nixvim.mkRemovedPackageOptionModule {
plugin = "neogit";
packageName = "git";
})
(lib.nixvim.mkRemovedPackageOptionModule {
plugin = "neogit";
packageName = "which";
})
]
++ (map
(
optionPath:
mkRemovedOptionModule
(
[
"plugins"
"neogit"
]
++ optionPath
)
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
)
[ [
# TODO: added 2025-04-07, remove after 25.05 [ "disableCommitConfirmation" ]
(lib.nixvim.mkRemovedPackageOptionModule { [ "disableBuiltinNotifications" ]
plugin = "neogit"; [ "useMagitKeybindings " ]
packageName = "git"; [ "commitPopup" ]
})
(lib.nixvim.mkRemovedPackageOptionModule {
plugin = "neogit";
packageName = "which";
})
]
++ (map
(
optionPath:
mkRemovedOptionModule
(
[
"plugins"
"neogit"
]
++ optionPath
)
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
)
[ [
[ "disableCommitConfirmation" ] "sections"
[ "disableBuiltinNotifications" ] "unmerged"
[ "useMagitKeybindings " ]
[ "commitPopup" ]
[
"sections"
"unmerged"
]
[
"sections"
"unpulled"
]
] ]
); [
"sections"
"unpulled"
]
]
);
optionsRenamedToSettings = [ optionsRenamedToSettings = [
"disableSigns" "disableSigns"
"disableHint" "disableHint"

View file

@ -14,38 +14,37 @@ let
cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName}; cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName};
in in
{ {
options.plugins.none-ls.sources.${sourceType}.${sourceName} = options.plugins.none-ls.sources.${sourceType}.${sourceName} = {
{ enable = lib.mkEnableOption "the ${sourceName} ${sourceType} source for none-ls";
enable = lib.mkEnableOption "the ${sourceName} ${sourceType} source for none-ls"; # Support strLua for compatibility with the old withArgs option
# Support strLua for compatibility with the old withArgs option settings = lib.nixvim.defaultNullOpts.mkStrLuaOr' {
settings = lib.nixvim.defaultNullOpts.mkStrLuaOr' { type = with lib.types; attrsOf anything;
type = with lib.types; attrsOf anything; description = ''
description = '' Options provided to the `require('null-ls').builtins.${sourceType}.${sourceName}.with` function.
Options provided to the `require('null-ls').builtins.${sourceType}.${sourceName}.with` function.
See upstream's [`BUILTIN_CONFIG`] documentation. See upstream's [`BUILTIN_CONFIG`] documentation.
[`BUILTIN_CONFIG`]: https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md [`BUILTIN_CONFIG`]: https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md
''; '';
example = { example = {
extra_filetypes = [ "toml" ]; extra_filetypes = [ "toml" ];
disabled_filetypes = [ "lua" ]; disabled_filetypes = [ "lua" ];
extra_args = [ extra_args = [
"-i" "-i"
"2" "2"
"-ci" "-ci"
]; ];
};
}; };
}
# Only declare a package option if a package is required
// lib.optionalAttrs (packaged ? ${sourceName}) {
package =
lib.nixvim.mkMaybeUnpackagedOption "plugins.none-ls.sources.${sourceType}.${sourceName}.package"
pkgs
sourceName
pkg;
}; };
}
# Only declare a package option if a package is required
// lib.optionalAttrs (packaged ? ${sourceName}) {
package =
lib.nixvim.mkMaybeUnpackagedOption "plugins.none-ls.sources.${sourceType}.${sourceName}.package"
pkgs
sourceName
pkg;
};
# TODO: Added 2024-07-16; remove after 24.11 # TODO: Added 2024-07-16; remove after 24.11
imports = imports =

View file

@ -4,14 +4,13 @@ let
mkSourcePlugin = import ./_mk-source-plugin.nix; mkSourcePlugin = import ./_mk-source-plugin.nix;
in in
{ {
imports = imports = [
[ ./prettier.nix
./prettier.nix ./prettierd.nix
./prettierd.nix ]
] ++ (lib.flatten (
++ (lib.flatten ( lib.mapAttrsToList (category: (lib.map (mkSourcePlugin category))) noneLsBuiltins
lib.mapAttrsToList (category: (lib.map (mkSourcePlugin category))) noneLsBuiltins ));
));
config = config =
let let

View file

@ -158,7 +158,8 @@ in
extra_opts = extraOpts; extra_opts = extraOpts;
}; };
}; };
} // cfg.extraOptions; }
// cfg.extraOptions;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -1186,12 +1186,10 @@ in
nested = true; nested = true;
}); });
extraConfigLua = extraConfigLua = (optionalString autoOpenEnabled openNvimTreeFunction) + ''
(optionalString autoOpenEnabled openNvimTreeFunction)
+ ''
require('nvim-tree').setup(${lib.nixvim.toLuaObject setupOptions}) require('nvim-tree').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
dependencies.git.enable = lib.mkDefault true; dependencies.git.enable = lib.mkDefault true;
}; };

View file

@ -207,7 +207,8 @@ in
reading_text = cfg.readingText; reading_text = cfg.readingText;
workspace_text = cfg.workspaceText; workspace_text = cfg.workspaceText;
line_number_text = cfg.lineNumberText; line_number_text = cfg.lineNumberText;
} // cfg.extraOptions; }
// cfg.extraOptions;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -125,7 +125,8 @@ in
standalone file support standalone file support
setting it to false may improve startup time setting it to false may improve startup time
''; '';
} // import ../../lsp/language-servers/rust-analyzer-config.nix lib; }
// import ../../lsp/language-servers/rust-analyzer-config.nix lib;
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraPlugins = [ extraPlugins = [
@ -174,7 +175,8 @@ in
inherit (cfg.server) standalone; inherit (cfg.server) standalone;
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server; settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
}; };
} // cfg.extraOptions; }
// cfg.extraOptions;
in in
'' ''
require('rust-tools').setup(${lib.nixvim.toLuaObject options}) require('rust-tools').setup(${lib.nixvim.toLuaObject options})

View file

@ -52,7 +52,8 @@ in
let let
setupOptions = { setupOptions = {
inherit (cfg) skipInsignificantPunctuation; inherit (cfg) skipInsignificantPunctuation;
} // cfg.extraOptions; }
// cfg.extraOptions;
mappings = mapAttrsToList (motion: key: { mappings = mapAttrsToList (motion: key: {
mode = [ mode = [

View file

@ -331,7 +331,8 @@ in
folded_section = foldedSection; folded_section = foldedSection;
}; };
inherit (cfg) parts; inherit (cfg) parts;
} // sections; }
// sections;
in in
'' ''
require('startup').setup(${lib.nixvim.toLuaObject setupOptions}) require('startup').setup(${lib.nixvim.toLuaObject setupOptions})

View file

@ -56,7 +56,8 @@ let
options = settingsOptions; options = settingsOptions;
example = settingsExample; example = settingsExample;
}; };
} // extraOptions; }
// extraOptions;
config = lib.mkIf cfg.enable ( config = lib.mkIf cfg.enable (
lib.mkMerge [ lib.mkMerge [

View file

@ -29,7 +29,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
imports = [ imports = [
# Register nvim-cmp association # Register nvim-cmp association
{ cmpSourcePlugins.codeium = "windsurf-nvim"; } { cmpSourcePlugins.codeium = "windsurf-nvim"; }
] ++ (import ./deprecations.nix { inherit lib; }).imports; ]
++ (import ./deprecations.nix { inherit lib; }).imports;
settingsExample = { settingsExample = {
enable_chat = true; enable_chat = true;

View file

@ -70,21 +70,20 @@ lib.nixvim.plugins.mkNeovimPlugin {
callSetup = false; callSetup = false;
extraConfig = cfg: { extraConfig = cfg: {
plugins.cmp.luaConfig.content = plugins.cmp.luaConfig.content = ''
'' local cmp = require('cmp')
local cmp = require('cmp') cmp.setup(${toLuaObject cfg.settings})
cmp.setup(${toLuaObject cfg.settings})
'' ''
+ (lib.concatStringsSep "\n" ( + (lib.concatStringsSep "\n" (
lib.mapAttrsToList ( lib.mapAttrsToList (
filetype: settings: "cmp.setup.filetype('${filetype}', ${toLuaObject settings})\n" filetype: settings: "cmp.setup.filetype('${filetype}', ${toLuaObject settings})\n"
) cfg.filetype ) cfg.filetype
)) ))
+ (lib.concatStringsSep "\n" ( + (lib.concatStringsSep "\n" (
lib.mapAttrsToList ( lib.mapAttrsToList (
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${toLuaObject settings})\n" cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${toLuaObject settings})\n"
) cfg.cmdline ) cfg.cmdline
)); ));
}; };
} }

View file

@ -168,7 +168,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
options = { options = {
inherit (cfg.keymaps) silent; inherit (cfg.keymaps) silent;
desc = "${descPrefix} ${actionStr}"; desc = "${descPrefix} ${actionStr}";
} // actionProps; }
// actionProps;
} }
); );
in in

View file

@ -144,7 +144,8 @@ in
type = types.attrsOf types.anything; type = types.attrsOf types.anything;
description = "Extra options for the ${name} language server."; description = "Extra options for the ${name} language server.";
}; };
} // extraOptions; }
// extraOptions;
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
@ -170,7 +171,8 @@ in
opts = opts.settings; opts = opts.settings;
enabled = true; enabled = true;
}; };
} // cfg.extraOptions; }
// cfg.extraOptions;
} }
]; ];
}; };

View file

@ -548,49 +548,37 @@ in
with cfg.pythonPackage.pkgs; with cfg.pythonPackage.pkgs;
{ {
pylsp_mypy = pylsp-mypy.overridePythonAttrs (old: { pylsp_mypy = pylsp-mypy.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' substituteInPlace setup.cfg \
+ '' --replace-fail "python-lsp-server >=1.7.0" ""
substituteInPlace setup.cfg \ '';
--replace-fail "python-lsp-server >=1.7.0" ""
'';
}); });
isort = pyls-isort.overridePythonAttrs (old: { isort = pyls-isort.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' substituteInPlace setup.py \
+ '' --replace-fail 'install_requires=["python-lsp-server", "isort"],' 'install_requires=["isort"],'
substituteInPlace setup.py \ '';
--replace-fail 'install_requires=["python-lsp-server", "isort"],' 'install_requires=["isort"],'
'';
}); });
black = python-lsp-black.overridePythonAttrs (old: { black = python-lsp-black.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' substituteInPlace setup.cfg \
+ '' --replace-fail "python-lsp-server>=1.4.0" ""
substituteInPlace setup.cfg \ '';
--replace-fail "python-lsp-server>=1.4.0" ""
'';
}); });
memestra = pyls-memestra.overridePythonAttrs (old: { memestra = pyls-memestra.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' sed -i '/python-lsp-server/d' requirements.txt
+ '' '';
sed -i '/python-lsp-server/d' requirements.txt
'';
}); });
rope = pylsp-rope.overridePythonAttrs (old: { rope = pylsp-rope.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' sed -i '/python-lsp-server/d' setup.cfg
+ '' '';
sed -i '/python-lsp-server/d' setup.cfg
'';
}); });
ruff = python-lsp-ruff.overridePythonAttrs (old: { ruff = python-lsp-ruff.overridePythonAttrs (old: {
postPatch = postPatch = old.postPatch or '''' + ''
old.postPatch or '''' sed -i '/python-lsp-server/d' pyproject.toml
+ '' '';
sed -i '/python-lsp-server/d' pyproject.toml
'';
build-system = [ setuptools ] ++ (old.build-system or [ ]); build-system = [ setuptools ] ++ (old.build-system or [ ]);
}); });

View file

@ -38,27 +38,26 @@ let
let let
inherit (pkgs.stdenv) hostPlatform; inherit (pkgs.stdenv) hostPlatform;
disabled = disabled = [
[ # DEPRECATED SERVERS
# DEPRECATED SERVERS # See https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig.lua
# See https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig.lua "ruff_lsp"
"ruff_lsp" "bufls"
"bufls" "typst_lsp"
"typst_lsp" ]
] ++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [
++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [ # TODO: 2025-04-20 build failure (swift-corelibs-xctest)
# TODO: 2025-04-20 build failure (swift-corelibs-xctest) "sourcekit"
"sourcekit"
# pkgs.vectorcode is not available on this platform # pkgs.vectorcode is not available on this platform
"vectorcode_server" "vectorcode_server"
# TODO: 2024-10-05 build failure # TODO: 2024-10-05 build failure
"fstar" "fstar"
# TODO: 2025-03-04 marked as broken # TODO: 2025-03-04 marked as broken
"nickel_ls" "nickel_ls"
]; ];
in in
{ {
inherit _file; inherit _file;

View file

@ -22,81 +22,79 @@
"_module" "_module"
]; ];
brokenTools = brokenTools = [
[ #TODO Added 2025-04-01
#TODO Added 2025-04-01 # php-cs-fixer is marked as broken
# php-cs-fixer is marked as broken "php_cs_fixer"
"php_cs_fixer" # TODO: Added 2025-04-19 broken dependency
# TODO: Added 2025-04-19 broken dependency "phan"
"phan" "php"
"php" "phpcbf"
"phpcbf" "phpcs"
"phpcs" "phpstan"
"phpstan" "psalm"
"psalm" ]
] ++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [
++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [ # TODO: 2025-04-20 build failure (swift-corelibs-xctest)
# TODO: 2025-04-20 build failure (swift-corelibs-xctest) "swiftformat"
"swiftformat" ]
] ++ lib.optionals hostPlatform.isDarwin [
++ lib.optionals hostPlatform.isDarwin [ # As of 2024-01-04, texliveMedium is broken on darwin
# As of 2024-01-04, texliveMedium is broken on darwin # TODO: re-enable those tests when fixed
# TODO: re-enable those tests when fixed "chktex"
"chktex" "latexindent"
"latexindent"
# TODO 2025-04-20 build failure # TODO 2025-04-20 build failure
"ansible_lint" "ansible_lint"
] ]
++ lib.optionals (hostPlatform.isDarwin && hostPlatform.isAarch64) [ ++ lib.optionals (hostPlatform.isDarwin && hostPlatform.isAarch64) [
# As of 2025-03-18, several python311Packages.* dependencies of bashate fail on aarch64-darwin # As of 2025-03-18, several python311Packages.* dependencies of bashate fail on aarch64-darwin
# TODO: re-enable this test when fixed # TODO: re-enable this test when fixed
"bashate" "bashate"
] ]
++ lib.optionals (hostPlatform.isDarwin && hostPlatform.isx86_64) [ ++ lib.optionals (hostPlatform.isDarwin && hostPlatform.isx86_64) [
# As of 2024-07-31, dmd is broken on x86_64-darwin # As of 2024-07-31, dmd is broken on x86_64-darwin
# https://github.com/NixOS/nixpkgs/pull/331373 # https://github.com/NixOS/nixpkgs/pull/331373
# TODO: re-enable this test when fixed # TODO: re-enable this test when fixed
"dmd" "dmd"
]; ];
# TODO: respect unpackaged from generated # TODO: respect unpackaged from generated
unpackaged = unpackaged = [
[ "blade_formatter"
"blade_formatter" "cljstyle"
"cljstyle" "cspell"
"cspell" "dartanalyzer"
"dartanalyzer" "debride"
"debride" "deno_fmt"
"deno_fmt" "fecs"
"fecs" "fixjson"
"fixjson" "forge_fmt"
"forge_fmt" "gersemi"
"gersemi" "gleam_format"
"gleam_format" "js_standard"
"js_standard" "kdlfmt"
"kdlfmt" "markuplint"
"markuplint" "mix"
"mix" "pint"
"pint" "prettier_eslint"
"prettier_eslint" "prettier_standard"
"prettier_standard" "redpen"
"redpen" "reek"
"reek" "rome"
"rome" "ruff_sort"
"ruff_sort" "slim_lint"
"slim_lint" "solhint"
"solhint" "sorbet"
"sorbet" "swiftformat"
"swiftformat" "swiftlint"
"swiftlint" "xo"
"xo" ]
] ++ lib.optionals pkgs.stdenv.isDarwin [ "clazy" ]
++ lib.optionals pkgs.stdenv.isDarwin [ "clazy" ] ++ lib.optionals pkgs.stdenv.isAarch64 [
++ lib.optionals pkgs.stdenv.isAarch64 [ "dmd"
"dmd" "smlfmt"
"smlfmt" ];
];
# Fetch the valid enum members from the tool options # Fetch the valid enum members from the tool options
toolsFromOptions = toolsFromOptions =

View file

@ -105,27 +105,26 @@
sources = sources =
let let
disabled = disabled = [
[ #TODO Added 2025-04-01
#TODO Added 2025-04-01 # php-cs-fixer is marked as broken
# php-cs-fixer is marked as broken "phpcsfixer"
"phpcsfixer" ]
] ++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [
++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [ # Not available on aarch64-linux
# Not available on aarch64-linux "smlfmt"
"smlfmt"
# TODO: 2025-04-20 build failure (swift-corelibs-xctest) # TODO: 2025-04-20 build failure (swift-corelibs-xctest)
"swift_format" "swift_format"
# TODO: 2025-04-20 build failure (open-policy-agent) # TODO: 2025-04-20 build failure (open-policy-agent)
"opacheck" "opacheck"
"rego" "rego"
] ]
++ lib.optionals hostPlatform.isDarwin [ ++ lib.optionals hostPlatform.isDarwin [
# TODO 2025-04-20 build failure # TODO 2025-04-20 build failure
"ansiblelint" "ansiblelint"
]; ];
in in
# Enable every none-ls source that has an option # Enable every none-ls source that has an option
lib.mapAttrs ( lib.mapAttrs (

View file

@ -20,22 +20,21 @@
let let
inherit (pkgs.stdenv) hostPlatform; inherit (pkgs.stdenv) hostPlatform;
disabledSources = disabledSources = [
[ # We do not provide the required HF_API_KEY environment variable.
# We do not provide the required HF_API_KEY environment variable. "cmp_ai"
"cmp_ai" # Triggers the warning complaining about treesitter highlighting being disabled
# Triggers the warning complaining about treesitter highlighting being disabled "otter"
"otter" # Invokes the `nix` command at startup which is not available in the sandbox
# Invokes the `nix` command at startup which is not available in the sandbox "nixpkgs_maintainers"
"nixpkgs_maintainers" # Needs internet access to download `sm-agent`
# Needs internet access to download `sm-agent` "supermaven"
"supermaven" # Sometimes get auth error
# Sometimes get auth error "codeium"
"codeium" ]
] ++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [
++ lib.optionals (hostPlatform.isLinux && hostPlatform.isAarch64) [ "cmp_tabnine"
"cmp_tabnine" ];
];
in in
pipe config.cmpSourcePlugins [ pipe config.cmpSourcePlugins [
# All known source names # All known source names