diff --git a/extra.nix b/extra.nix index 767d5dd6..6794c489 100644 --- a/extra.nix +++ b/extra.nix @@ -151,6 +151,7 @@ inputs: let vim.utility = { colorizer.enable = true; + vim-wakatime.enable = true; icon-picker.enable = true; diffview-nvim.enable = true; motion = { diff --git a/modules/utility/default.nix b/modules/utility/default.nix index 1bd03c64..96589dd0 100644 --- a/modules/utility/default.nix +++ b/modules/utility/default.nix @@ -8,5 +8,6 @@ _: { ./icon-picker ./telescope ./diffview + ./wakatime ]; } diff --git a/modules/utility/wakatime/config.nix b/modules/utility/wakatime/config.nix new file mode 100644 index 00000000..fb990747 --- /dev/null +++ b/modules/utility/wakatime/config.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with builtins; let + cfg = config.vim.utility.vim-wakatime; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + pkgs.vimPlugins.vim-wakatime + ]; + + vim.configRC.vim-wakatime = nvim.dag.entryAnywhere '' + ${ + if cfg.cli-package == null + then "" + else ''let g:wakatime_CLIPath = "${cfg.cli-package}"'' + } + ''; + }; +} diff --git a/modules/utility/wakatime/default.nix b/modules/utility/wakatime/default.nix new file mode 100644 index 00000000..d6d67d57 --- /dev/null +++ b/modules/utility/wakatime/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./vim-wakatime.nix + ]; +} diff --git a/modules/utility/wakatime/vim-wakatime.nix b/modules/utility/wakatime/vim-wakatime.nix new file mode 100644 index 00000000..2df357eb --- /dev/null +++ b/modules/utility/wakatime/vim-wakatime.nix @@ -0,0 +1,17 @@ +{ + lib, + pkgs, + ... +}: +with lib; +with builtins; { + options.vim.utility.vim-wakatime = { + enable = mkEnableOption "Enable vim-wakatime"; + + cli-package = mkOption { + type = with types; 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`"; + }; + }; +}