modules: explicit lib usage

This commit is contained in:
raf 2024-02-20 02:05:36 +03:00
commit caf342adb1
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
27 changed files with 673 additions and 684 deletions

View file

@ -4,7 +4,9 @@
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types;
inherit (lib.types) enum float nullOr package str;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.meta) getExe;
cfg = config.vim.assistant.copilot;
in {
@ -14,7 +16,7 @@ in {
panel = {
position = mkOption {
type = types.enum [
type = enum [
"bottom"
"top"
"left"
@ -24,7 +26,7 @@ in {
description = "Panel position";
};
ratio = mkOption {
type = types.float;
type = float;
default = 0.4;
description = "Panel size";
};
@ -33,81 +35,81 @@ in {
mappings = {
panel = {
jumpPrev = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "[[";
description = "Jump to previous suggestion";
};
jumpNext = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "]]";
description = "Jump to next suggestion";
};
accept = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<CR>";
description = "Accept suggestion";
};
refresh = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "gr";
description = "Refresh suggestions";
};
open = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<M-CR>";
description = "Open suggestions";
};
};
suggestion = {
accept = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<M-l>";
description = "Accept suggetion";
};
acceptWord = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = null;
description = "Accept next word";
};
acceptLine = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = null;
description = "Accept next line";
};
prev = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<M-[>";
description = "Previous suggestion";
};
next = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<M-]>";
description = "Next suggestion";
};
dismiss = mkOption {
type = types.nullOr types.str;
type = nullOr str;
default = "<C-]>";
description = "Dismiss suggestion";
};
};
};
copilotNodeCommand = mkOption {
type = types.str;
default = "${lib.getExe cfg.copilotNodePackage}";
description = ''
The command that will be executed to initiate nodejs for GitHub Copilot.
Recommended to leave as default.
'';
};
copilotNodePackage = mkOption {
type = with types; nullOr package;
type = nullOr package;
default = pkgs.nodejs-slim;
description = ''
The nodeJS package that will be used for GitHub Copilot. If you are using a custom node command
you may want to set this option to null so that the package is not pulled from nixpkgs.
'';
};
copilotNodeCommand = mkOption {
type = str;
default = "${getExe cfg.copilotNodePackage}";
description = ''
The command that will be executed to initiate nodejs for GitHub Copilot.
Recommended to leave as default.
'';
};
};
}