From 90815dea99d51482d34c15dabc7c4f8f513be344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E4=BA=95=20=E5=AF=9B=E5=A4=A7?= Date: Sun, 9 Aug 2026 09:15:16 +0900 Subject: [PATCH] fix(nix-monitor): make generation checks configurable (#308) --- nix-monitor/README.md | 5 +++-- nix-monitor/nix_monitor_service.luau | 3 ++- nix-monitor/plugin.toml | 10 +++++++++- nix-monitor/translations/en.json | 4 ++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/nix-monitor/README.md b/nix-monitor/README.md index e78d5ba..12d596a 100644 --- a/nix-monitor/README.md +++ b/nix-monitor/README.md @@ -41,8 +41,9 @@ Update behavior: | --- | --- | --- | | `update_check_interval` | `60` | Minutes between remote revision checks. | | `update_check_duration_threshold` | `5` | Minutes before an update check is cancelled. | -| `system_stats_check_interval` | `10` | Minutes between store-statistics checks. | -| `system_stats_check_duration_threshold` | `5` | Minutes before a statistics check is cancelled. | +| `generation_check_interval` | `60` | Minutes between NixOS and Home Manager generation checks. | +| `system_stats_check_interval` | `60` | Minutes between store-statistics checks. | +| `system_stats_check_duration_threshold` | `15` | Minutes before a statistics check is cancelled. | | `show_update_check_notification` | `false` | Notifies when an update check starts and finishes. | | `show_update_available_notification` | `true` | Notifies when a newer revision is available. | | `branch` | `nixos-unstable` | Nixpkgs branch compared by the service. | diff --git a/nix-monitor/nix_monitor_service.luau b/nix-monitor/nix_monitor_service.luau index 6ae9c47..f5bbd45 100644 --- a/nix-monitor/nix_monitor_service.luau +++ b/nix-monitor/nix_monitor_service.luau @@ -37,6 +37,7 @@ end local branch = cfg("branch") local updateCheckInterval = cfg("update_check_interval") local updateCheckDurationThreshold = cfg("update_check_duration_threshold") +local generationsCheckInterval = cfg("generation_check_interval") local systemStatsCheckInterval = cfg("system_stats_check_interval") local systemStatsCheckDurationThreshold = cfg("system_stats_check_duration_threshold") local stateDir = noctalia.pluginDataDir() or "/tmp/nix-monitor" @@ -292,7 +293,7 @@ function update() end -- Generations check - if (os.time() - getState("lastGenerationsCheckTime")) >= 10 then + if (os.time() - getState("lastGenerationsCheckTime")) >= 60 * generationsCheckInterval then checkGenerations() end diff --git a/nix-monitor/plugin.toml b/nix-monitor/plugin.toml index 46adb52..0b66267 100644 --- a/nix-monitor/plugin.toml +++ b/nix-monitor/plugin.toml @@ -1,6 +1,6 @@ id = "avivbintangaringga/nix-monitor" name = "Nix Monitor" -version = "1.3.0" +version = "1.3.1" plugin_api = 3 icon = "package" author = "avivbintangaringga" @@ -128,6 +128,14 @@ default = 5 min = 1 max = 30 +[[setting]] +key = "generation_check_interval" +type = "int" +label_key = "setting.generation_check_interval.label" +description_key = "setting.generation_check_interval.description" +default = 60 +min = 1 + [[setting]] key = "system_stats_check_mode" type = "select" diff --git a/nix-monitor/translations/en.json b/nix-monitor/translations/en.json index 419749d..1187eb3 100644 --- a/nix-monitor/translations/en.json +++ b/nix-monitor/translations/en.json @@ -40,6 +40,10 @@ "description": "Add 'Press enter to exit' on the terminal window", "label": "Close on press Enter" }, + "generation_check_interval": { + "description": "How often to check NixOS and Home Manager generations (in minutes)", + "label": "Generation check interval" + }, "hide_clean_button": { "description": "Whether to hide the clean button on the panel", "label": "Hide clean button"