utility/wakatime: move plugin options to vim.globals; cleanup

This commit is contained in:
NotAShelf 2025-01-04 15:29:11 +03:00
parent e614860a12
commit fcc6aa485c
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
3 changed files with 20 additions and 10 deletions

View file

@ -1,18 +1,22 @@
{
config,
lib,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.meta) getExe;
cfg = config.vim.utility.vim-wakatime;
in {
config = mkIf cfg.enable {
vim.startPlugins = [pkgs.vimPlugins.vim-wakatime];
vim = {
startPlugins = [pkgs.vimPlugins.vim-wakatime];
vim.pluginRC.vim-wakatime = mkIf (cfg.cli-package != null) ''
vim.g.wakatime_CLIPath = "${cfg.cli-package}"
'';
# Wakatime configuration is stored as vim globals.
globals = {
"wakatime_CLIPath" = mkIf (cfg.cli-package != null) "${getExe cfg.cli-package}";
};
};
};
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./config.nix
./vim-wakatime.nix

View file

@ -1,18 +1,24 @@
{
lib,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) nullOr package;
in {
options.vim.utility.vim-wakatime = {
enable = mkEnableOption "vim-wakatime: live code statistics";
enable = mkEnableOption ''
automatic time tracking and metrics generated from your programming activity [vim-wakatime]
'';
cli-package = mkOption {
type = nullOr package;
default = pkgs.wakatime;
description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`";
default = pkgs.wakatime-cli;
example = null;
description = ''
The package that should be used for wakatime-cli.
Set as null to use the default path in {env}`$XDG_DATA_HOME`
'';
};
};
}