Commit 88c6b99ac9b6

Vincent Demeester <vincent@sbr.pm>
2026-01-26 10:08:40
feat(home): add gh-news home-manager module with notifications
Add a home-manager module for gh-news (GitHub notifications TUI) with: - TOML configuration file generation - Desktop notifications via notify-send - Auto-refresh settings - Preview mode and filter configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9dcb6bd
Changed files (6)
dots/.config/claude/settings.json
@@ -65,5 +65,6 @@
     "/home/vincent/src/home",
     "/home/vincent/src/tekton-watcher",
     "/home/vincent/src/go-ci"
-  ]
+  ],
+  "model": "claude-opus-4-5@20251101"
 }
home/common/dev/default.nix
@@ -2,6 +2,7 @@
 {
   imports = [
     ./ai.nix
+    ./gh-news.nix
     ./go.nix
     ./lazyworktree.nix
     ./lua.nix
home/common/dev/gh-news.nix
@@ -0,0 +1,20 @@
+{ ... }:
+{
+  imports = [ ../../modules/gh-news.nix ];
+
+  programs.gh-news = {
+    enable = true;
+    enableNotifications = true;
+
+    settings = {
+      auto_refresh_interval = 240;
+      api_timeout = 30;
+      pagination_size = 50;
+      show_read = false;
+      participating_only = false;
+      default_preview_mode = "vertical";
+      repos_collapsed = false;
+      auto_mark_read = false;
+    };
+  };
+}
home/common/dev/lazyworktree.nix
@@ -39,6 +39,7 @@
     aliases = {
       # Home configuration
       wh = "${config.home.homeDirectory}/src/home";
+      wtp = "${config.home.homeDirectory}/src/tektoncd/pipeline/main";
     };
   };
 }
home/modules/gh-news.nix
@@ -0,0 +1,61 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+let
+  cfg = config.programs.gh-news;
+
+  tomlFormat = pkgs.formats.toml { };
+
+  notifyScript = pkgs.writeShellScript "gh-news-notify" ''
+    ${pkgs.libnotify}/bin/notify-send \
+      --app-name="gh-news" \
+      --icon="github" \
+      --urgency="normal" \
+      --expire-time="5000" \
+      "GitHub: $GH_NEWS_REPO" \
+      "$GH_NEWS_TITLE"
+  '';
+
+  finalSettings =
+    cfg.settings
+    // lib.optionalAttrs (cfg.enableNotifications && !cfg.settings ? on_new_notification_command) {
+      on_new_notification_command = toString notifyScript;
+    };
+in
+{
+  options.programs.gh-news = {
+    enable = lib.mkEnableOption "gh-news configuration";
+
+    package = lib.mkPackageOption pkgs "gh-news" { nullable = true; };
+
+    enableNotifications = lib.mkEnableOption "desktop notifications via notify-send";
+
+    settings = lib.mkOption {
+      type = tomlFormat.type;
+      default = { };
+      example = lib.literalExpression ''
+        {
+          auto_refresh_interval = 120;
+          api_timeout = 30;
+          show_read = false;
+          default_preview_mode = "vertical";
+        }
+      '';
+      description = ''
+        Configuration written to {file}`$XDG_CONFIG_HOME/gh-news/config.toml`.
+        See <https://github.com/chmouel/gh-news> for supported values.
+      '';
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
+
+    xdg.configFile."gh-news/config.toml" = lib.mkIf (finalSettings != { }) {
+      source = tomlFormat.generate "gh-news-config" finalSettings;
+    };
+  };
+}
systems/kyushu/home.nix
@@ -9,6 +9,7 @@ in
 {
   imports = [
     ../../home/common/dev/containers.nix
+    ../../home/common/dev/gh-news.nix
     ../../home/common/dev/lazyworktree.nix
     ../../home/common/dev/tektoncd.nix
     ../../home/common/services/color-scheme-timer.nix
@@ -71,7 +72,6 @@ in
 
     go-org-readwise
     gh-pr
-    gh-news
     arr
     claude-hooks
     toggle-color-scheme