From 97899667db987c37b658c7ca21be9a1580d40a72 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 27 Feb 2023 22:26:47 +0300 Subject: [PATCH] feat: apply new module format to rich-presence plugins --- modules/rich-presence/default.nix | 5 +++ .../rich-presence/presence-nvim/config.nix | 41 +++++++++++++++++++ .../presence-nvim}/default.nix | 1 + .../presence-nvim}/presence-nvim.nix | 31 -------------- 4 files changed, 47 insertions(+), 31 deletions(-) create mode 100644 modules/rich-presence/default.nix create mode 100644 modules/rich-presence/presence-nvim/config.nix rename modules/{presence => rich-presence/presence-nvim}/default.nix (74%) rename modules/{presence => rich-presence/presence-nvim}/presence-nvim.nix (63%) diff --git a/modules/rich-presence/default.nix b/modules/rich-presence/default.nix new file mode 100644 index 0000000..ef16a42 --- /dev/null +++ b/modules/rich-presence/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./presence-nvim + ]; +} diff --git a/modules/rich-presence/presence-nvim/config.nix b/modules/rich-presence/presence-nvim/config.nix new file mode 100644 index 0000000..351074b --- /dev/null +++ b/modules/rich-presence/presence-nvim/config.nix @@ -0,0 +1,41 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.presence.presence-nvim; +in { + config = mkIf cfg.enable { + vim.startPlugins = ["presence-nvim"]; + + vim.luaConfigRC.presence-nvim = nvim.dag.entryAnywhere '' + -- Description of each option can be found in https://github.com/andweeb/presence.nvim + require("presence").setup({ + -- General options + auto_update = true, + neovim_image_text = "${cfg.image_text}", + 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 = {}, + show_time = "${boolToString cfg.show_time}", + + -- Rich Presence text options + editing_text = "${cfg.rich_presence.editing_text}", + file_explorer_text = "${cfg.rich_presence.file_explorer_text}", + git_commit_text = "${cfg.rich_presence.git_commit_text}", + plugin_manager_text = "${cfg.rich_presence.plugin_manager_text}", + reading_text = "${cfg.rich_presence.reading_text}", + workspace_text = "${cfg.rich_presence.workspace_text}", + line_number_text = "${cfg.rich_presence.line_number_text}", + }) + ''; + }; +} diff --git a/modules/presence/default.nix b/modules/rich-presence/presence-nvim/default.nix similarity index 74% rename from modules/presence/default.nix rename to modules/rich-presence/presence-nvim/default.nix index bc4e28b..e263c3a 100644 --- a/modules/presence/default.nix +++ b/modules/rich-presence/presence-nvim/default.nix @@ -1,5 +1,6 @@ _: { imports = [ + ./config.nix ./presence-nvim.nix ]; } diff --git a/modules/presence/presence-nvim.nix b/modules/rich-presence/presence-nvim/presence-nvim.nix similarity index 63% rename from modules/presence/presence-nvim.nix rename to modules/rich-presence/presence-nvim/presence-nvim.nix index 7d27733..c3f80ff 100644 --- a/modules/presence/presence-nvim.nix +++ b/modules/rich-presence/presence-nvim/presence-nvim.nix @@ -96,35 +96,4 @@ in { }; }; }; - - config = mkIf cfg.enable { - vim.startPlugins = ["presence-nvim"]; - - vim.luaConfigRC.presence-nvim = nvim.dag.entryAnywhere '' - -- Description of each option can be found in https://github.com/andweeb/presence.nvim - require("presence").setup({ - -- General options - auto_update = true, - neovim_image_text = "${cfg.image_text}", - 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 = {}, - show_time = "${boolToString cfg.show_time}", - - -- Rich Presence text options - editing_text = "${cfg.rich_presence.editing_text}", - file_explorer_text = "${cfg.rich_presence.file_explorer_text}", - git_commit_text = "${cfg.rich_presence.git_commit_text}", - plugin_manager_text = "${cfg.rich_presence.plugin_manager_text}", - reading_text = "${cfg.rich_presence.reading_text}", - workspace_text = "${cfg.rich_presence.workspace_text}", - line_number_text = "${cfg.rich_presence.line_number_text}", - }) - ''; - }; }