treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -4,10 +4,12 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-fish;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.cmp-fish = {
fishPackage = mkOption {
@ -21,7 +23,5 @@ in {
};
};
config = mkIf cfg.enable {
extraPackages = [cfg.fishPackage];
};
config = mkIf cfg.enable { extraPackages = [ cfg.fishPackage ]; };
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-git;
in {
in
{
options.plugins.cmp-git.settings = helpers.neovim-plugin.mkSettingsOption {
pluginName = "cmp_git";
options = {
@ -30,13 +32,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').git.commits";}''
"Function used to sort the commits.";
''{__raw = "require('cmp_git.sort').git.commits";}''
"Function used to sort the commits.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').git.commits";}''
"Function used to format the commits.";
''{__raw = "require('cmp_git.format').git.commits";}''
"Function used to format the commits.";
};
};
@ -47,9 +49,8 @@ in {
issues = {
fields =
helpers.defaultNullOpts.mkListOf types.str
''["title" "number" "body" "updatedAt" "state"]''
"The fields used for issues.";
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
"The fields used for issues.";
filter = helpers.defaultNullOpts.mkStr "all" ''
The filter to use when fetching issues.
@ -65,13 +66,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.issues";}''
"Function used to sort the issues.";
''{__raw = "require('cmp_git.sort').github.issues";}''
"Function used to sort the issues.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.issues";}''
"Function used to format the issues.";
''{__raw = "require('cmp_git.format').github.issues";}''
"Function used to format the issues.";
};
mentions = {
@ -81,20 +82,19 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.mentions";}''
"Function used to sort the mentions.";
''{__raw = "require('cmp_git.sort').github.mentions";}''
"Function used to sort the mentions.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.mentions";}''
"Function used to format the mentions.";
''{__raw = "require('cmp_git.format').github.mentions";}''
"Function used to format the mentions.";
};
pull_requests = {
fields =
helpers.defaultNullOpts.mkListOf types.str
''["title" "number" "body" "updatedAt" "state"]''
"The fields used for pull requests.";
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
"The fields used for pull requests.";
limit = helpers.defaultNullOpts.mkUnsignedInt 100 ''
Max number of pull requests to fetch.
@ -106,13 +106,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
"Function used to sort the pull requests.";
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
"Function used to sort the pull requests.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.pull_requests";}''
"Function used to format the pull requests.";
''{__raw = "require('cmp_git.format').github.pull_requests";}''
"Function used to format the pull requests.";
};
};
@ -132,13 +132,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
"Function used to sort the issues.";
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
"Function used to sort the issues.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.issues";}''
"Function used to format the issues.";
''{__raw = "require('cmp_git.format').gitlab.issues";}''
"Function used to format the issues.";
};
mentions = {
@ -148,13 +148,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
"Function used to sort the mentions.";
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
"Function used to sort the mentions.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
"Function used to format the mentions.";
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
"Function used to format the mentions.";
};
merge_requests = {
@ -168,114 +168,118 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
"Function used to sort the merge requests.";
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
"Function used to sort the merge requests.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
"Function used to format the merge requests.";
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
"Function used to format the merge requests.";
};
};
trigger_actions =
helpers.defaultNullOpts.mkListOf
(types.submodule {
options = {
debug_name = helpers.mkNullOrStr "Debug name.";
(types.submodule {
options = {
debug_name = helpers.mkNullOrStr "Debug name.";
trigger_character = mkOption {
type = types.str;
example = ":";
description = ''
The trigger character.
Has to be a single character
'';
};
trigger_character = mkOption {
type = types.str;
example = ":";
description = ''
The trigger character.
Has to be a single character
'';
};
action = mkOption {
type = helpers.nixvimTypes.strLuaFn;
apply = helpers.mkRaw;
description = ''
The parameters to the action function are the different sources (currently `git`,
`gitlab` and `github`), the completion callback, the trigger character, the
parameters passed to complete from nvim-cmp, and the current git info.
'';
example = ''
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
'';
action = mkOption {
type = helpers.nixvimTypes.strLuaFn;
apply = helpers.mkRaw;
description = ''
The parameters to the action function are the different sources (currently `git`,
`gitlab` and `github`), the completion callback, the trigger character, the
parameters passed to complete from nvim-cmp, and the current git info.
'';
example = ''
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
'';
};
};
};
})
''
[
{
debug_name = "git_commits";
trigger_character = ":";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_issues";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_issues(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mrs";
trigger_character = "!";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_issues_and_pr";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
]
''
''
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
add an entry in the `trigger_actions` list of the config.
The two necessary fields are the `trigger_character` and the `action`.
'';
})
''
[
{
debug_name = "git_commits";
trigger_character = ":";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_issues";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_issues(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mrs";
trigger_character = "!";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_issues_and_pr";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
]
''
''
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
add an entry in the `trigger_actions` list of the config.
The two necessary fields are the `trigger_character` and the `action`.
'';
};
example = {
remotes = ["upstream" "origin" "foo"];
remotes = [
"upstream"
"origin"
"foo"
];
github.issues = {
filter = "all";
limit = 250;

View file

@ -4,41 +4,44 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-tabby;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.cmp-tabby =
helpers.neovim-plugin.extraOptionsOptions
// {
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
The address of the tabby host server.
'';
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
The address of the tabby host server.
'';
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
The max number of lines to complete.
'';
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
The max number of lines to complete.
'';
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
Whether to run the completion on every keystroke.
'';
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
Whether to run the completion on every keystroke.
'';
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
};
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
};
config = mkIf cfg.enable {
extraConfigLua = let
setupOptions = with cfg;
{
inherit host;
max_lines = maxLines;
run_on_every_keystroke = runOnEveryKeyStroke;
inherit stop;
}
// cfg.extraOptions;
in ''
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
'';
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit host;
max_lines = maxLines;
run_on_every_keystroke = runOnEveryKeyStroke;
inherit stop;
}
// cfg.extraOptions;
in
''
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-tabnine;
in {
in
{
options.plugins.cmp-tabnine = helpers.neovim-plugin.extraOptionsOptions;
config = mkIf cfg.enable {

View file

@ -5,85 +5,79 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.codeium-nvim;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.codeium-nvim =
helpers.neovim-plugin.extraOptionsOptions
// {
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
configPath =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}''
"The path to the config file, used to store the API key.";
configPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}'' "The path to the config file, used to store the API key.";
binPath =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}''
"The path to the directory where the Codeium server will be downloaded to.";
binPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}'' "The path to the directory where the Codeium server will be downloaded to.";
api = {
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
The hostname of the API server to use.
'';
api = {
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
The hostname of the API server to use.
'';
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
The port of the API server to use.
'';
};
tools = {
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
languageServer = helpers.mkNullOrOption types.str ''
The path to the language server downloaded from the official source.
'';
};
wrapper = helpers.mkNullOrOption types.str ''
The path to a wrapper script/binary that is used to execute any binaries not listed under
tools.
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
codeium server.
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
The port of the API server to use.
'';
};
config = mkIf cfg.enable {
extraConfigLua = let
setupOptions = with cfg;
{
config_path = configPath;
bin_path = binPath;
api = with api; {
inherit host;
port =
if isInt port
then toString port
else port;
};
tools = with tools; {
inherit
uname
uuidgen
curl
gzip
;
language_server = languageServer;
};
inherit wrapper;
}
// cfg.extraOptions;
in ''
require('codeium').setup(${helpers.toLuaObject setupOptions})
tools = {
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
languageServer = helpers.mkNullOrOption types.str ''
The path to the language server downloaded from the official source.
'';
};
wrapper = helpers.mkNullOrOption types.str ''
The path to a wrapper script/binary that is used to execute any binaries not listed under
tools.
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
codeium server.
'';
};
config = mkIf cfg.enable {
extraConfigLua =
let
setupOptions =
with cfg;
{
config_path = configPath;
bin_path = binPath;
api = with api; {
inherit host;
port = if isInt port then toString port else port;
};
tools = with tools; {
inherit
uname
uuidgen
curl
gzip
;
language_server = languageServer;
};
inherit wrapper;
}
// cfg.extraOptions;
in
''
require('codeium').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,63 +4,58 @@
config,
...
}:
with lib; let
with lib;
let
copilot-lua-cfg = config.plugins.copilot-lua;
cfg = config.plugins.copilot-cmp;
in {
options.plugins.copilot-cmp =
helpers.neovim-plugin.extraOptionsOptions
// {
event =
helpers.defaultNullOpts.mkNullable
(with types; listOf str)
''["InsertEnter" "LspAttach"]''
in
{
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
event =
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
''
Configures when the source is registered.
Unless you have a unique problem for your particular configuration you probably don't want
to touch this.
'';
fixPairs = helpers.defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
fixPairs = helpers.defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
This is not good behavior for consistency reasons and will just end up deleting the two ending
characters.
This option fixes that.
Don't turn this off unless you are having problems with pairs and believe this might be
causing them.
'';
};
This is not good behavior for consistency reasons and will just end up deleting the two ending
characters.
This option fixes that.
Don't turn this off unless you are having problems with pairs and believe this might be
causing them.
'';
};
config = mkIf cfg.enable {
warnings =
optional
((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled)
''
optional ((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled) ''
It is recommended to disable copilot's `suggestion` module, as it can interfere with
completions properly appearing in copilot-cmp.
''
++ optional
(
(!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled
)
''
++ optional ((!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled) ''
It is recommended to disable copilot's `panel` module, as it can interfere with completions
properly appearing in copilot-cmp.
'';
plugins.copilot-lua.enable = true;
extraConfigLua = let
setupOptions = with cfg;
{
inherit event;
fix_pairs = fixPairs;
}
// cfg.extraOptions;
in ''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
'';
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit event;
fix_pairs = fixPairs;
}
// cfg.extraOptions;
in
''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.crates-nvim;
in {
in
{
options.plugins.crates-nvim = helpers.neovim-plugin.extraOptionsOptions;
config = mkIf cfg.enable {

View file

@ -5,27 +5,28 @@
pkgs,
...
}:
with lib; let
cmpLib = import ../cmp-helpers.nix {inherit lib config helpers pkgs;};
with lib;
let
cmpLib = import ../cmp-helpers.nix {
inherit
lib
config
helpers
pkgs
;
};
cmpSourcesPluginNames = attrValues (import ../sources.nix);
pluginModules =
map
(
name:
cmpLib.mkCmpSourcePlugin {inherit name;}
)
cmpSourcesPluginNames;
in {
pluginModules = map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
in
{
# For extra cmp plugins
imports =
[
./codeium-nvim.nix
./copilot-cmp.nix
./cmp-fish.nix
./cmp-git.nix
./cmp-tabby.nix
./cmp-tabnine.nix
./crates-nvim.nix
]
++ pluginModules;
imports = [
./codeium-nvim.nix
./copilot-cmp.nix
./cmp-fish.nix
./cmp-git.nix
./cmp-tabby.nix
./cmp-tabnine.nix
./crates-nvim.nix
] ++ pluginModules;
}