From d81f37256d0a8691b837b74979d27bf89be8ecdd Mon Sep 17 00:00:00 2001 From: Axel Karjalainen Date: Mon, 17 Mar 2025 01:33:22 +0200 Subject: [PATCH] plugins/aw-watcher: init --- plugins/by-name/aw-watcher/default.nix | 53 +++++++++++++++++++ .../plugins/by-name/aw-watcher/default.nix | 44 +++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 plugins/by-name/aw-watcher/default.nix create mode 100644 tests/test-sources/plugins/by-name/aw-watcher/default.nix diff --git a/plugins/by-name/aw-watcher/default.nix b/plugins/by-name/aw-watcher/default.nix new file mode 100644 index 00000000..eaf7b2a6 --- /dev/null +++ b/plugins/by-name/aw-watcher/default.nix @@ -0,0 +1,53 @@ +{ lib, ... }: +let + inherit (lib.nixvim) defaultNullOpts; +in +lib.nixvim.plugins.mkNeovimPlugin { + name = "aw-watcher"; + moduleName = "aw_watcher"; + packPathName = "aw-watcher.nvim"; + package = "aw-watcher-nvim"; + + maintainers = [ lib.maintainers.axka ]; + + settingsOptions = { + bucket = { + hostname = defaultNullOpts.mkStr { __raw = "vim.uv.os_gethostname()"; } '' + The hostname to be presented to the ActivityWatch server. + Defaults to the hostname of the computer. + ''; + + name = defaultNullOpts.mkStr { __raw = "'aw-watcher-neovim_' .. bucket.hostname'"; } '' + The name of the bucket in the ActivityWatch server. + ''; + }; + aw_server = { + host = defaultNullOpts.mkStr "127.0.0.1" '' + Host to connect to. + ''; + + port = defaultNullOpts.mkUnsignedInt 5600 '' + Port to connect to. + ''; + + ssl_enable = defaultNullOpts.mkBool false '' + Whether the ActivityWatch server should be connected to using HTTPS. + ''; + + pulsetime = defaultNullOpts.mkUnsignedInt 30 '' + The maximum amount of time (in seconds) between two consecutive events + (heartbeats) with the same data (e.g. same file path) that will cause + them to be merged into a single event. This is useful for saving on + storage space and disk I/O. + ''; + }; + }; + + settingsExample = { + aw_server = { + host = "127.0.0.1"; + port = 5600; + pulsetime = 60; + }; + }; +} diff --git a/tests/test-sources/plugins/by-name/aw-watcher/default.nix b/tests/test-sources/plugins/by-name/aw-watcher/default.nix new file mode 100644 index 00000000..d0288736 --- /dev/null +++ b/tests/test-sources/plugins/by-name/aw-watcher/default.nix @@ -0,0 +1,44 @@ +{ + empty = { + # don't run tests as they try to access the network. + test.runNvim = false; + plugins.aw-watcher.enable = true; + }; + + defaults = { + # don't run tests as they try to access the network. + test.runNvim = false; + plugins.aw-watcher = { + enable = true; + + settings = { + bucket = { + hostname = "nixvim"; + name = "aw-watcher-neovim_nixvim"; + }; + aw_server = { + host = "127.0.0.1"; + port = 5600; + ssl_enable = false; + pulsetime = 30; + }; + }; + }; + }; + + example = { + # don't run tests as they try to access the network. + test.runNvim = false; + plugins.aw-watcher = { + enable = true; + + settings = { + aw_server = { + host = "127.0.0.1"; + port = 5600; + pulsetime = 60; + }; + }; + }; + }; +}