2022-10-17 21:09:24 +08:00
|
|
|
{
|
2023-02-20 11:42:13 +01:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.plugins.copilot;
|
|
|
|
helpers = import ../helpers.nix {inherit lib;};
|
|
|
|
in {
|
2022-10-17 21:09:24 +08:00
|
|
|
options = {
|
|
|
|
plugins.copilot = {
|
2023-01-22 03:32:08 +00:00
|
|
|
enable = mkEnableOption "copilot";
|
2023-01-25 19:46:49 +01:00
|
|
|
package = helpers.mkPackageOption "copilot" pkgs.vimPlugins.copilot-vim;
|
2022-10-17 21:09:24 +08:00
|
|
|
filetypes = mkOption {
|
|
|
|
type = types.attrsOf types.bool;
|
|
|
|
description = "A dictionary mapping file types to their enabled status";
|
2023-02-20 11:42:13 +01:00
|
|
|
default = {};
|
|
|
|
example = literalExpression '' {
|
|
|
|
"*": false,
|
|
|
|
python: true
|
|
|
|
}'';
|
2022-10-17 21:09:24 +08:00
|
|
|
};
|
|
|
|
proxy = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Tell Copilot what proxy server to use.";
|
|
|
|
default = null;
|
|
|
|
example = "localhost:3128";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
extraPlugins = [cfg.package];
|
|
|
|
globals =
|
|
|
|
{
|
2022-10-17 21:09:24 +08:00
|
|
|
copilot_node_command = "${pkgs.nodejs-16_x}/bin/node";
|
|
|
|
copilot_filetypes = cfg.filetypes;
|
2023-02-20 11:42:13 +01:00
|
|
|
}
|
|
|
|
// (
|
|
|
|
if cfg.proxy != null
|
|
|
|
then {copilot_proxy = cfg.proxy;}
|
|
|
|
else {}
|
|
|
|
);
|
|
|
|
};
|
2022-10-17 21:09:24 +08:00
|
|
|
}
|