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 = { vim.presence = {
presence-nvim = { neocord.enable = true;
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";
};
};
}; };
}; };
}; };

View file

@ -778,6 +778,22 @@
"type": "github" "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": { "neodev-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1397,22 +1413,6 @@
"type": "github" "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": { "project-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1511,6 +1511,7 @@
"mind-nvim": "mind-nvim", "mind-nvim": "mind-nvim",
"minimap-vim": "minimap-vim", "minimap-vim": "minimap-vim",
"modes-nvim": "modes-nvim", "modes-nvim": "modes-nvim",
"neocord": "neocord",
"neodev-nvim": "neodev-nvim", "neodev-nvim": "neodev-nvim",
"nil": "nil", "nil": "nil",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
@ -1545,7 +1546,6 @@
"orgmode-nvim": "orgmode-nvim", "orgmode-nvim": "orgmode-nvim",
"oxocarbon": "oxocarbon", "oxocarbon": "oxocarbon",
"plenary-nvim": "plenary-nvim", "plenary-nvim": "plenary-nvim",
"presence-nvim": "presence-nvim",
"project-nvim": "project-nvim", "project-nvim": "project-nvim",
"registers": "registers", "registers": "registers",
"rnix-lsp": "rnix-lsp", "rnix-lsp": "rnix-lsp",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,31 +1,58 @@
{ {lib, ...}: let
config, inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule;
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types;
in { in {
options.vim.presence.presence-nvim = { imports = [
enable = mkEnableOption "presence.nvim plugin for discord rich presence"; (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; type = types.str;
default = "The One True Text Editor"; default = "The One True Text Editor";
description = "Text displayed when hovering over the Neovim image"; description = "Text displayed when hovering over the Neovim image";
}; };
main_image = mkOption { main_image = mkOption {
type = types.str; type = types.enum ["language" "logo"];
default = "neovim"; default = "language";
description = "Main image to be displayed"; description = "Main image to be displayed";
}; };
client_id = mkOption { client_id = mkOption {
type = types.str; type = types.str;
default = "79327144129396737"; default = "1157438221865717891";
description = "Client ID of the application"; 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 { auto_update = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -38,18 +65,19 @@ in {
description = "Show line number on the RPC item"; 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 { show_time = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Show time on the RPC item"; 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 = { rich_presence = {
editing_text = mkOption { editing_text = mkOption {
type = types.str; type = types.str;
@ -92,6 +120,12 @@ in {
default = "Line %s out of %s"; default = "Line %s out of %s";
description = "Text displayed when showing line number"; 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";
};
}; };
}; };
} }