feat: apply new module format to rich-presence plugins

This commit is contained in:
NotAShelf 2023-02-27 22:26:47 +03:00
parent 4d1e7bcbe6
commit 97899667db
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
4 changed files with 47 additions and 31 deletions

View file

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

View file

@ -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}",
})
'';
};
}

View file

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

View file

@ -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}",
})
'';
};
} }