Commit 4d7251fe963d
Changed files (4)
dots
.config
gh-news
home
common
dev
modules
dots/.config/gh-news/config.toml
@@ -0,0 +1,45 @@
+# gh-news configuration
+# See https://github.com/chmouel/gh-news for all options
+
+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
+
+# Desktop notifications via notify-send
+on_new_notification_command = "notify-send --app-name=gh-news --icon=github --urgency=normal --expire-time=5000 'GitHub: $GH_NEWS_REPO' '$GH_NEWS_TITLE'"
+
+# Custom actions
+[[actions]]
+name = "Open in lazypr"
+command = "lazypr {url}"
+interactive = true
+
+[[actions]]
+name = "Copy URL"
+command = "echo -n {url} | wl-copy"
+interactive = false
+
+[[actions]]
+name = "Open lazyworktree"
+command = "cd $(repo-find {full_name}) && lazyworktree"
+interactive = true
+
+[[actions]]
+name = "Create worktree from PR"
+command = "cd $(repo-find {full_name}) && lazyworktree create --from-pr $(echo {url} | grep -oE 'pull/[0-9]+' | grep -oE '[0-9]+')"
+interactive = true
+
+[[actions]]
+name = "Review with Claude"
+command = "gh-news-review -d {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Claude (yolo)"
+command = "gh-news-review -d -y {url}"
+interactive = false
dots/Makefile
@@ -50,6 +50,9 @@ aichat-roles : ~/.config/aichat/roles
all += lazypr
lazypr : ~/.config/lazypr/config.toml
+all += gh-news
+gh-news : ~/.config/gh-news/config.toml
+
# Backward compatibility: symlink ~/.claude to ~/.config/claude
~/.claude : force
@echo "๐ Creating backward compatibility symlink: ~/.claude -> ~/.config/claude"
home/common/dev/gh-news.nix
@@ -1,54 +1,10 @@
+# gh-news - GitHub notifications TUI
+# Config is managed via dots/.config/gh-news/config.toml
{ pkgs, ... }:
{
imports = [ ../../modules/gh-news.nix ];
home.packages = [ pkgs.repo-find ];
- 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;
-
- actions = [
- {
- name = "Open in lazypr";
- command = "lazypr {url}";
- interactive = true;
- }
- {
- name = "Copy URL";
- command = "echo -n {url} | wl-copy";
- }
- {
- name = "Open lazyworktree";
- command = "cd $(repo-find {full_name}) && lazyworktree";
- interactive = true;
- }
- {
- name = "Create worktree from PR";
- command = "cd $(repo-find {full_name}) && lazyworktree create --from-pr $(echo {url} | grep -oE 'pull/[0-9]+' | grep -oE '[0-9]+')";
- interactive = true;
- }
- {
- name = "Review with Claude";
- command = "gh-news-review -d {url}";
- interactive = false;
- }
- {
- name = "Review with Claude (yolo)";
- command = "gh-news-review -d -y {url}";
- interactive = false;
- }
- ];
- };
- };
+ programs.gh-news.enable = true;
}
home/modules/gh-news.nix
@@ -1,3 +1,5 @@
+# Simplified gh-news module - just provides a wrapper that injects GH_TOKEN
+# Config is managed via dots/.config/gh-news/config.toml
{
config,
lib,
@@ -6,62 +8,21 @@
}:
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";
+ enable = lib.mkEnableOption "gh-news with GH_TOKEN wrapper";
- 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.
- '';
- };
+ package = lib.mkPackageOption pkgs "gh-news" { };
};
config = lib.mkIf cfg.enable {
- home.packages = lib.mkIf (cfg.package != null) [
+ home.packages = [
# 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;
- };
};
}