modules/rich-presence: deprecate presence-nvim in favor of neocord

This commit is contained in:
NotAShelf 2024-01-05 19:24:02 +03:00
parent 2b4683fa81
commit 428e49d303
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
8 changed files with 95 additions and 67 deletions

View file

@ -232,17 +232,7 @@ inputs: let
};
vim.presence = {
presence-nvim = {
enable = true;
auto_update = true;
image_text = "The Superior Text Editor";
client_id = "793271441293967371";
main_image = "neovim";
show_time = true;
rich_presence = {
editing_text = "Editing %s";
};
};
neocord.enable = true;
};
};
};

View file

@ -778,6 +778,22 @@
"type": "github"
}
},
"neocord": {
"flake": false,
"locked": {
"lastModified": 1704948184,
"narHash": "sha256-HnaMKTNjMuDwHDvxHH5kd4ysa5WU+MlbdD9jH/iJcU8=",
"owner": "IogaMaster",
"repo": "neocord",
"rev": "9b624d5189f699ab454e9515262c13965395b8dd",
"type": "github"
},
"original": {
"owner": "IogaMaster",
"repo": "neocord",
"type": "github"
}
},
"neodev-nvim": {
"flake": false,
"locked": {
@ -1397,22 +1413,6 @@
"type": "github"
}
},
"presence-nvim": {
"flake": false,
"locked": {
"lastModified": 1674984077,
"narHash": "sha256-ZpsunLsn//zYgUtmAm5FqKVueVd/Pa1r55ZDqxCimBk=",
"owner": "andweeb",
"repo": "presence.nvim",
"rev": "87c857a56b7703f976d3a5ef15967d80508df6e6",
"type": "github"
},
"original": {
"owner": "andweeb",
"repo": "presence.nvim",
"type": "github"
}
},
"project-nvim": {
"flake": false,
"locked": {
@ -1511,6 +1511,7 @@
"mind-nvim": "mind-nvim",
"minimap-vim": "minimap-vim",
"modes-nvim": "modes-nvim",
"neocord": "neocord",
"neodev-nvim": "neodev-nvim",
"nil": "nil",
"nixpkgs": "nixpkgs",
@ -1545,7 +1546,6 @@
"orgmode-nvim": "orgmode-nvim",
"oxocarbon": "oxocarbon",
"plenary-nvim": "plenary-nvim",
"presence-nvim": "presence-nvim",
"project-nvim": "project-nvim",
"registers": "registers",
"rnix-lsp": "rnix-lsp",

View file

@ -262,9 +262,9 @@
};
# Presence
presence-nvim = {
url = "github:andweeb/presence.nvim";
flake = false;
neocord = {
url = "github:IogaMaster/neocord";
flake = false; # uses flake-utils, avoid the flake
};
# Autopairs

View file

@ -53,7 +53,7 @@ with lib; let
"cheatsheet-nvim"
"ccc"
"cellular-automaton"
"presence-nvim"
"neocord"
"icon-picker-nvim"
"dressing-nvim"
"orgmode-nvim"

View file

@ -1,5 +1,5 @@
_: {
{
imports = [
./presence-nvim
./neocord
];
}

View file

@ -4,26 +4,29 @@
...
}: let
inherit (lib) mkIf nvim boolToString;
inherit (lib.nvim.lua) listToLuaTable;
inherit (builtins) toString;
cfg = config.vim.presence.presence-nvim;
cfg = config.vim.presence.neocord;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["presence-nvim"];
vim.startPlugins = ["neocord"];
vim.luaConfigRC.presence-nvim = nvim.dag.entryAnywhere ''
-- Description of each option can be found in https://github.com/andweeb/presence.nvim
require("presence").setup({
vim.luaConfigRC.neocord = nvim.dag.entryAnywhere ''
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
require("neocord").setup({
-- General options
auto_update = true,
neovim_image_text = "${cfg.image_text}",
logo = "${cfg.logo}",
logo_tooltip = "${cfg.logo_tooltip}",
main_image = "${cfg.main_image}",
client_id = "${cfg.client_id}",
log_level = nil,
debounce_timeout = 10,
enable_line_number = "${boolToString cfg.enable_line_number}",
blacklist = {},
buttons = "${boolToString cfg.buttons}",
file_assets = {},
log_level = "${
if cfg.log_level == null
then "nil"
else cfg.log_level
}",
debounce_timeout = ${toString cfg.debounce_timeout},
blacklist = ${listToLuaTable cfg.blacklist},
show_time = "${boolToString cfg.show_time}",
-- Rich Presence text options
@ -34,6 +37,7 @@ in {
reading_text = "${cfg.rich_presence.reading_text}",
workspace_text = "${cfg.rich_presence.workspace_text}",
line_number_text = "${cfg.rich_presence.line_number_text}",
terminal_text = "${cfg.rich_presence.terminal_text}",
})
'';
};

View file

@ -1,6 +1,6 @@
_: {
{
imports = [
./config.nix
./presence-nvim.nix
./neocord.nix
];
}

View file

@ -1,31 +1,58 @@
{
config,
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types;
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule;
in {
options.vim.presence.presence-nvim = {
enable = mkEnableOption "presence.nvim plugin for discord rich presence";
imports = [
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
Options provided by the plugin remain mostly the same, but manual migration is required.
image_text = mkOption {
Please see neocord documentation and the neovim-flake options for more info
'')
];
options.vim.presence.neocord = {
enable = mkEnableOption "neocord plugin for discord rich presence";
logo = mkOption {
type = types.str; # TODO: can the default be documented better, maybe with an enum?
default = "auto";
description = ''
Logo to be displayed on the RPC item
This must be either "auto" or an URL to your image of choice
'';
};
logo_tooltip = mkOption {
type = types.str;
default = "The One True Text Editor";
description = "Text displayed when hovering over the Neovim image";
};
main_image = mkOption {
type = types.str;
default = "neovim";
type = types.enum ["language" "logo"];
default = "language";
description = "Main image to be displayed";
};
client_id = mkOption {
type = types.str;
default = "79327144129396737";
default = "1157438221865717891";
description = "Client ID of the application";
};
log_level = mkOption {
type = with types; nullOr (enum ["debug" "info" "warn" "error"]);
default = null;
description = "Log level to be used by the plugin";
};
debounce_timeout = mkOption {
type = types.int;
default = 10;
description = "Number of seconds to debounce events";
};
auto_update = mkOption {
type = types.bool;
default = true;
@ -38,18 +65,19 @@ in {
description = "Show line number on the RPC item";
};
buttons = mkOption {
type = types.bool;
default = true;
description = "Show buttons on the RPC item";
};
show_time = mkOption {
type = types.bool;
default = true;
description = "Show time on the RPC item";
};
blacklist = mkOption {
type = with types; listOf str;
default = [];
example = literalExpression ''["Alpha"]'';
description = "List of filetypes to ignore";
};
rich_presence = {
editing_text = mkOption {
type = types.str;
@ -92,6 +120,12 @@ in {
default = "Line %s out of %s";
description = "Text displayed when showing line number";
};
terminal_text = mkOption {
type = types.str;
default = "Working on the terminal";
description = "Text displayed when working on the terminal";
};
};
};
}