treewide: make lib calls explicit

This commit is contained in:
Frothy 2024-03-23 20:14:39 -04:00
commit 974bfcc78e
56 changed files with 589 additions and 496 deletions

View file

@ -3,17 +3,19 @@
lib,
...
}: let
inherit (lib) mkIf nvim boolToString;
inherit (lib.nvim.lua) listToLuaTable;
inherit (lib.strings) escapeNixString;
inherit (builtins) toString;
inherit (lib.modules) mkIf;
inherit (lib.trivial) boolToString;
inherit (lib.strings) escapeNixString;
inherit (lib.nvim.lua) listToLuaTable;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.presence.neocord;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["neocord"];
vim.luaConfigRC.neocord = nvim.dag.entryAnywhere ''
vim.luaConfigRC.neocord = entryAnywhere ''
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
require("neocord").setup({
-- General options

View file

@ -1,5 +1,7 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule;
inherit (lib.modules) mkRemovedOptionModule;
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) bool int str enum nullOr listOf;
in {
imports = [
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
@ -14,7 +16,7 @@ in {
enable = mkEnableOption "neocord plugin for discord rich presence";
logo = mkOption {
type = types.str; # TODO: can the default be documented better, maybe with an enum?
type = str; # TODO: can the default be documented better, maybe with an enum?
default = "auto";
description = ''
Logo to be displayed on the RPC item
@ -24,55 +26,55 @@ in {
};
logo_tooltip = mkOption {
type = types.str;
type = str;
default = "The One True Text Editor";
description = "Text displayed when hovering over the Neovim image";
};
main_image = mkOption {
type = types.enum ["language" "logo"];
type = enum ["language" "logo"];
default = "language";
description = "Main image to be displayed";
};
client_id = mkOption {
type = types.str;
type = str;
default = "1157438221865717891";
description = "Client ID of the application";
};
log_level = mkOption {
type = with types; nullOr (enum ["debug" "info" "warn" "error"]);
type = nullOr (enum ["debug" "info" "warn" "error"]);
default = null;
description = "Log level to be used by the plugin";
};
debounce_timeout = mkOption {
type = types.int;
type = int;
default = 10;
description = "Number of seconds to debounce events";
};
auto_update = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Automatically update the presence";
};
enable_line_number = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Show line number on the RPC item";
};
show_time = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Show time on the RPC item";
};
blacklist = mkOption {
type = with types; listOf str;
type = listOf str;
default = [];
example = literalExpression ''["Alpha"]'';
description = "List of filetypes to ignore";
@ -80,49 +82,49 @@ in {
rich_presence = {
editing_text = mkOption {
type = types.str;
type = str;
default = "Editing %s";
description = "Text displayed when editing a file";
};
file_explorer_text = mkOption {
type = types.str;
type = str;
default = "Browsing %s";
description = "Text displayed when browsing files";
};
git_commit_text = mkOption {
type = types.str;
type = str;
default = "Committing changes";
description = "Text displayed when committing changes";
};
plugin_manager_text = mkOption {
type = types.str;
type = str;
default = "Managing plugins";
description = "Text displayed when managing plugins";
};
reading_text = mkOption {
type = types.str;
type = str;
default = "Reading %s";
description = "Text displayed when reading a file";
};
workspace_text = mkOption {
type = types.str;
type = str;
default = "Working on %s";
description = "Text displayed when working on a project";
};
line_number_text = mkOption {
type = types.str;
type = str;
default = "Line %s out of %s";
description = "Text displayed when showing line number";
};
terminal_text = mkOption {
type = types.str;
type = str;
default = "Working on the terminal";
description = "Text displayed when working on the terminal";
};