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
flake.lib =
{
nixvim = lib.makeOverridable (import ../lib) {
inherit lib;
flake = self;
};
overlay = lib.makeOverridable (import ../lib/overlay.nix) {
flake = self;
};
# Top-top-level aliases
inherit (self.lib.nixvim)
evalNixvim
;
}
// lib.genAttrs config.systems (
lib.flip withSystem (
{ pkgs, system, ... }:
{
# NOTE: this is the publicly documented flake output we've had for a while
check = pkgs.callPackage ../lib/tests.nix {
inherit lib self system;
};
flake.lib = {
nixvim = lib.makeOverridable (import ../lib) {
inherit lib;
flake = self;
};
overlay = lib.makeOverridable (import ../lib/overlay.nix) {
flake = self;
};
# Top-top-level aliases
inherit (self.lib.nixvim)
evalNixvim
;
}
// lib.genAttrs config.systems (
lib.flip withSystem (
{ pkgs, system, ... }:
{
# NOTE: this is the publicly documented flake output we've had for a while
check = pkgs.callPackage ../lib/tests.nix {
inherit lib self 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;
}
)
);
# 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;
}
)
);
}

View file

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

View file

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

View file

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

View file

@ -7,79 +7,78 @@ let
];
in
{
imports =
[
(mkRemovedOptionModule (basePluginPath ++ [ "server" ]) ''
To configure the `clangd` language server options, please use
`plugins.lsp.servers.clangd.extraSettings`.
'')
(mkRemovedOptionModule (
basePluginPath
++ [
"extensions"
"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" ]
imports = [
(mkRemovedOptionModule (basePluginPath ++ [ "server" ]) ''
To configure the `clangd` language server options, please use
`plugins.lsp.servers.clangd.extraSettings`.
'')
(mkRemovedOptionModule (
basePluginPath
++ [
"extensions"
"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" ]
]
);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -70,210 +70,209 @@ lib.nixvim.plugins.mkVimPlugin {
];
};
settingsOptions =
{
preview_win_location = defaultNullOpts.mkEnumFirstDefault [ "bo" "to" "bel" "abo" ] ''
This option determines where the preview window pops up as a result of the
`:GitGutterPreviewHunk` command.
settingsOptions = {
preview_win_location = defaultNullOpts.mkEnumFirstDefault [ "bo" "to" "bel" "abo" ] ''
This option determines where the preview window pops up as a result of the
`:GitGutterPreviewHunk` command.
See the end of the `|opening-window|` docs.
'';
See the end of the `|opening-window|` docs.
'';
git_executable = defaultNullOpts.mkStr' {
pluginDefault = "git";
example = lib.literalExpression "lib.getExe pkgs.git";
description = ''
This option determines what `git` binary to use.
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_executable = defaultNullOpts.mkStr' {
pluginDefault = "git";
example = lib.literalExpression "lib.getExe pkgs.git";
description = ''
This option determines what `git` binary to use.
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.
'';
};
settingsExample = {
set_sign_backgrounds = true;
sign_modified_removed = "*";

View file

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

View file

@ -214,39 +214,38 @@ lib.nixvim.plugins.mkNeovimPlugin {
extraConfig = cfg: {
autoCmd = lib.optionals (cfg.autoCmd != null) [ cfg.autoCmd ];
plugins.lint.luaConfig.content =
''
local __lint = require('lint')
''
+ (lib.optionalString (cfg.lintersByFt != null) ''
__lint.linters_by_ft = ${toLuaObject cfg.lintersByFt}
'')
+ (lib.optionalString (cfg.customLinters != null) (
lib.concatLines (
plugins.lint.luaConfig.content = ''
local __lint = require('lint')
''
+ (lib.optionalString (cfg.lintersByFt != null) ''
__lint.linters_by_ft = ${toLuaObject cfg.lintersByFt}
'')
+ (lib.optionalString (cfg.customLinters != null) (
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 (
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 (
linter: linterConfig:
lib.mapAttrsToList (
linter: linterConfig:
lib.mapAttrsToList (
propName: propValue:
lib.optionalString (
propValue != null
) "__lint.linters.${linter}.${propName} = ${toLuaObject propValue}"
) linterConfig
) cfg.linters
)
propName: propValue:
lib.optionalString (
propValue != null
) "__lint.linters.${linter}.${propName} = ${toLuaObject propValue}"
) linterConfig
) cfg.linters
)
));
)
));
};
}

View file

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

View file

@ -12,46 +12,45 @@ lib.nixvim.plugins.mkNeovimPlugin {
# TODO introduced 2024-02-29: remove 2024-04-29
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
(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."
)
[ "disableCommitConfirmation" ]
[ "disableBuiltinNotifications" ]
[ "useMagitKeybindings " ]
[ "commitPopup" ]
[
[ "disableCommitConfirmation" ]
[ "disableBuiltinNotifications" ]
[ "useMagitKeybindings " ]
[ "commitPopup" ]
[
"sections"
"unmerged"
]
[
"sections"
"unpulled"
]
"sections"
"unmerged"
]
);
[
"sections"
"unpulled"
]
]
);
optionsRenamedToSettings = [
"disableSigns"
"disableHint"

View file

@ -14,38 +14,37 @@ let
cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName};
in
{
options.plugins.none-ls.sources.${sourceType}.${sourceName} =
{
enable = lib.mkEnableOption "the ${sourceName} ${sourceType} source for none-ls";
# Support strLua for compatibility with the old withArgs option
settings = lib.nixvim.defaultNullOpts.mkStrLuaOr' {
type = with lib.types; attrsOf anything;
description = ''
Options provided to the `require('null-ls').builtins.${sourceType}.${sourceName}.with` function.
options.plugins.none-ls.sources.${sourceType}.${sourceName} = {
enable = lib.mkEnableOption "the ${sourceName} ${sourceType} source for none-ls";
# Support strLua for compatibility with the old withArgs option
settings = lib.nixvim.defaultNullOpts.mkStrLuaOr' {
type = with lib.types; attrsOf anything;
description = ''
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
'';
example = {
extra_filetypes = [ "toml" ];
disabled_filetypes = [ "lua" ];
extra_args = [
"-i"
"2"
"-ci"
];
};
[`BUILTIN_CONFIG`]: https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md
'';
example = {
extra_filetypes = [ "toml" ];
disabled_filetypes = [ "lua" ];
extra_args = [
"-i"
"2"
"-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
imports =

View file

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

View file

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

View file

@ -1186,12 +1186,10 @@ in
nested = true;
});
extraConfigLua =
(optionalString autoOpenEnabled openNvimTreeFunction)
+ ''
extraConfigLua = (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;
};

View file

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

View file

@ -125,7 +125,8 @@ in
standalone file support
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 {
extraPlugins = [
@ -174,7 +175,8 @@ in
inherit (cfg.server) standalone;
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
};
} // cfg.extraOptions;
}
// cfg.extraOptions;
in
''
require('rust-tools').setup(${lib.nixvim.toLuaObject options})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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