Commit 35101c4c42e2

Vincent Demeester <vincent@sbr.pm>
2026-01-28 15:51:42
fix(gh-news): wrap binary to auto-set GH_TOKEN
gh-news doesn't properly inherit gh auth context even as an extension. Remove from gh extensions and wrap the standalone binary to automatically set GH_TOKEN from `gh auth token`. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3ebb75e
Changed files (2)
home
common
shell
modules
home/common/shell/gh.nix
@@ -7,7 +7,8 @@
       gh-f
       gh-poi
       gh-s
-      gh-news
+      # gh-news is installed separately with a wrapper that sets GH_TOKEN
+      # (see home/common/dev/gh-news.nix and home/modules/gh-news.nix)
     ];
     settings = {
       git_protocol = "ssh";
home/modules/gh-news.nix
@@ -52,7 +52,13 @@ in
   };
 
   config = lib.mkIf cfg.enable {
-    home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
+    home.packages = lib.mkIf (cfg.package != null) [
+      # Wrap gh-news to automatically set GH_TOKEN from gh auth
+      (pkgs.writeShellScriptBin "gh-news" ''
+        export GH_TOKEN="$(${pkgs.gh}/bin/gh auth token)"
+        exec ${cfg.package}/bin/gh-news "$@"
+      '')
+    ];
 
     xdg.configFile."gh-news/config.toml" = lib.mkIf (finalSettings != { }) {
       source = tomlFormat.generate "gh-news-config" finalSettings;