Skip to content

Commit 1291f03

Browse files
committed
plugins/cmp: migrate all cmp sources to mkCmpPluginModule
1 parent 23bf22a commit 1291f03

File tree

12 files changed

+137
-23
lines changed

12 files changed

+137
-23
lines changed

plugins/by-name/cmp-ai/default.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
}:
55
let
66
inherit (lib.nixvim) defaultNullOpts;
7+
name = "cmp-ai";
78
in
89
lib.nixvim.plugins.mkNeovimPlugin {
9-
name = "cmp-ai";
10+
inherit name;
1011

1112
maintainers = [ lib.maintainers.GaetanLepage ];
1213

1314
imports = [
14-
{ cmpSourcePlugins.cmp_ai = "cmp-ai"; }
15+
(lib.nixvim.modules.mkCmpPluginModule {
16+
pluginName = name;
17+
sourceName = "cmp_ai";
18+
})
1519
];
1620

1721
moduleName = "cmp_ai.config";

plugins/by-name/cmp-git/default.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
lib,
33
...
44
}:
5-
lib.nixvim.plugins.mkNeovimPlugin {
5+
let
66
name = "cmp-git";
7+
in
8+
lib.nixvim.plugins.mkNeovimPlugin {
9+
inherit name;
710
moduleName = "cmp_git";
811

912
imports = [
10-
{ cmpSourcePlugins.git = "cmp-git"; }
13+
(lib.nixvim.modules.mkCmpPluginModule {
14+
pluginName = name;
15+
sourceName = "git";
16+
})
1117
];
1218

1319
maintainers = [ lib.maintainers.GaetanLepage ];

plugins/by-name/cmp-tabby/default.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
let
33
inherit (lib) types;
44
inherit (lib.nixvim) defaultNullOpts;
5+
name = "cmp-tabby";
56
in
67
lib.nixvim.plugins.mkNeovimPlugin {
7-
name = "cmp-tabby";
8+
inherit name;
89

910
maintainers = [ lib.maintainers.GaetanLepage ];
1011

1112
imports = [
12-
{ cmpSourcePlugins.cmp_tabby = "cmp-tabby"; }
13+
(lib.nixvim.modules.mkCmpPluginModule {
14+
pluginName = name;
15+
sourceName = "cmp_tabby";
16+
})
1317
];
1418

1519
deprecateExtraOptions = true;

plugins/by-name/cmp-tabnine/default.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
let
33
inherit (lib) types;
44
inherit (lib.nixvim) defaultNullOpts;
5+
name = "cmp-tabnine";
56
in
67
lib.nixvim.plugins.mkNeovimPlugin {
7-
name = "cmp-tabnine";
8+
inherit name;
89

910
maintainers = [ lib.maintainers.GaetanLepage ];
1011

1112
imports = [
12-
{ cmpSourcePlugins.cmp_tabnine = "cmp-tabnine"; }
13+
(lib.nixvim.modules.mkCmpPluginModule {
14+
pluginName = name;
15+
sourceName = "cmp_tabnine";
16+
})
1317
];
1418

1519
deprecateExtraOptions = true;

plugins/by-name/codeium-nvim/default.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
}:
55
let
66
inherit (lib.nixvim) defaultNullOpts;
7+
name = "codeium-nvim";
78
in
89
lib.nixvim.plugins.mkNeovimPlugin {
9-
name = "codeium-nvim";
10+
inherit name;
1011
packPathName = "codeium.nvim";
1112
moduleName = "codeium";
1213

@@ -51,9 +52,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
5152
"wrapper"
5253
];
5354

54-
# Register nvim-cmp association
5555
imports = [
56-
{ cmpSourcePlugins.codeium = "codeium-nvim"; }
56+
# Register nvim-cmp association
57+
(lib.nixvim.modules.mkCmpPluginModule {
58+
pluginName = name;
59+
sourceName = "codeium";
60+
})
5761
];
5862

5963
settingsOptions = {

plugins/by-name/copilot-cmp/default.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
let
33
inherit (lib) types;
44
inherit (lib.nixvim) defaultNullOpts;
5+
name = "copilot-cmp";
56
in
67
lib.nixvim.plugins.mkNeovimPlugin {
7-
name = "copilot-cmp";
8+
inherit name;
89
moduleName = "copilot_cmp";
910

1011
imports = [
11-
{ cmpSourcePlugins.copilot = "copilot-cmp"; }
12+
(lib.nixvim.modules.mkCmpPluginModule {
13+
pluginName = name;
14+
sourceName = "copilot";
15+
})
1216
];
1317

1418
maintainers = [ lib.maintainers.GaetanLepage ];

plugins/by-name/crates/default.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
{ lib, ... }:
2-
lib.nixvim.plugins.mkNeovimPlugin {
2+
let
33
name = "crates";
4+
in
5+
lib.nixvim.plugins.mkNeovimPlugin {
6+
inherit name;
47
packPathName = "crates.nvim";
58
package = "crates-nvim";
69

710
maintainers = [ lib.maintainers.GaetanLepage ];
811

912
imports =
10-
[ { cmpSourcePlugins.crates = "crates"; } ]
13+
[
14+
(lib.nixvim.modules.mkCmpPluginModule {
15+
pluginName = name;
16+
sourceName = name;
17+
})
18+
]
1119
++
1220
# TODO introduced 2024-12-12: remove after 25.05
1321
lib.nixvim.mkSettingsRenamedOptionModules [ "plugins" "crates-nvim" ]

plugins/by-name/papis/default.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
{ lib, pkgs, ... }:
2-
lib.nixvim.plugins.mkNeovimPlugin {
2+
let
33
name = "papis";
4+
in
5+
lib.nixvim.plugins.mkNeovimPlugin {
6+
inherit name;
47
packPathName = "papis.nvim";
58
package = "papis-nvim";
69

710
maintainers = [ lib.maintainers.GaetanLepage ];
811

9-
# papis.nvim is an nvim-cmp source too
10-
imports = [ { cmpSourcePlugins.papis = "papis"; } ];
12+
imports = [
13+
# papis.nvim is an nvim-cmp source too
14+
(lib.nixvim.modules.mkCmpPluginModule {
15+
pluginName = name;
16+
sourceName = name;
17+
})
18+
];
1119

1220
extraOptions = {
1321
yqPackage = lib.mkPackageOption pkgs "yq" {
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{ lib, ... }:
2-
lib.nixvim.plugins.mkVimPlugin {
2+
let
33
name = "vim-dadbod-completion";
4+
in
5+
lib.nixvim.plugins.mkVimPlugin {
6+
inherit name;
47
maintainers = [ lib.maintainers.BoneyPatel ];
58
imports = [
6-
{ cmpSourcePlugins.vim-dadbod-completion = "vim-dadbod-completion"; }
9+
(lib.nixvim.modules.mkCmpPluginModule {
10+
pluginName = name;
11+
sourceName = name;
12+
})
713
];
814
}

plugins/cmp/sources/_mk-cmp-plugin.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO: Remove this legacy function in favor of using `mkCmpPluginModule` directly
12
{
23
lib,
34
pkgs,
@@ -12,6 +13,8 @@
1213
] { },
1314
maintainers ? [ lib.maintainers.GaetanLepage ],
1415
imports ? [ ],
16+
# Whether to add a `plugin.*.blink` option, that uses blink.compat
17+
mkCmpPluginModuleArgs ? { },
1518
...
1619
}@args:
1720
lib.nixvim.plugins.mkVimPlugin (
@@ -24,8 +27,8 @@ lib.nixvim.plugins.mkVimPlugin (
2427
name = pluginName;
2528

2629
imports = imports ++ [
27-
# Register the source -> plugin name association
28-
{ cmpSourcePlugins.${sourceName} = pluginName; }
30+
# Create the `plugin.*.cmp` option
31+
(lib.nixvim.modules.mkCmpPluginModule (mkCmpPluginModuleArgs // { inherit pluginName sourceName; }))
2932
];
3033
}
3134
)

0 commit comments

Comments
 (0)