-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(tmux): move session logger to system services #1185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0f2ff3
d3afc34
078690b
8830dee
8e8520a
81c57cb
c8a3e9d
620c037
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||
| { pkgs, ... }: | ||||||
| let | ||||||
| inherit (pkgs) lib; | ||||||
| sessionLoggerScript = ../../programs/tmux/session-logger.sh; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if there's an existing mechanism that installs session-logger.sh to a known location
rg -l 'session-logger' --type nixRepository: shunkakinoki/dotfiles Length of output: 191 🏁 Script executed: cat -n home-manager/services/tmux-session-logger/default.nixRepository: shunkakinoki/dotfiles Length of output: 1809 🏁 Script executed: cat -n home-manager/programs/tmux/default.nixRepository: shunkakinoki/dotfiles Length of output: 632 🏁 Script executed: cat -n home-manager/services/default.nixRepository: shunkakinoki/dotfiles Length of output: 1149 Script path will fail at runtime; use the installed home directory location instead. The relative path The script is already installed to 🔧 Proposed fix- sessionLoggerScript = ../../programs/tmux/session-logger.sh;
+ sessionLoggerScript = "$HOME/.config/tmux/session-logger.sh";Or use the XDG base directory variable: - sessionLoggerScript = ../../programs/tmux/session-logger.sh;
+ sessionLoggerScript = "\${XDG_CONFIG_HOME:-$HOME/.config}/tmux/session-logger.sh";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| servicePath = lib.makeBinPath [ | ||||||
| pkgs.bash | ||||||
| pkgs.coreutils | ||||||
| pkgs.tmux | ||||||
| ]; | ||||||
| in | ||||||
| { | ||||||
| launchd.agents.tmux-session-logger = lib.mkIf pkgs.stdenv.isDarwin { | ||||||
| enable = true; | ||||||
| config = { | ||||||
| ProgramArguments = [ | ||||||
| "${pkgs.bash}/bin/bash" | ||||||
| "${sessionLoggerScript}" | ||||||
| ]; | ||||||
| Environment = { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Use Prompt for AI agents |
||||||
| PATH = "${servicePath}:/usr/bin:/bin:/usr/sbin:/sbin"; | ||||||
| }; | ||||||
| RunAtLoad = true; | ||||||
| StartInterval = 30; | ||||||
| StandardOutPath = "/tmp/tmux-session-logger.log"; | ||||||
| StandardErrorPath = "/tmp/tmux-session-logger.error.log"; | ||||||
| }; | ||||||
| }; | ||||||
|
|
||||||
| systemd.user.services.tmux-session-logger = lib.mkIf pkgs.stdenv.isLinux { | ||||||
| Unit = { | ||||||
| Description = "Persist tmux pane history snapshots"; | ||||||
| }; | ||||||
| Service = { | ||||||
| Type = "oneshot"; | ||||||
| Environment = "PATH=${servicePath}"; | ||||||
| ExecStart = "${pkgs.bash}/bin/bash ${sessionLoggerScript}"; | ||||||
| }; | ||||||
| }; | ||||||
|
|
||||||
| systemd.user.timers.tmux-session-logger = lib.mkIf pkgs.stdenv.isLinux { | ||||||
| Unit = { | ||||||
| Description = "Timer for tmux session history logging"; | ||||||
| }; | ||||||
| Timer = { | ||||||
| OnBootSec = "1s"; | ||||||
| OnUnitActiveSec = "30s"; | ||||||
| AccuracySec = "1s"; | ||||||
| Unit = "tmux-session-logger.service"; | ||||||
| }; | ||||||
| Install = { | ||||||
| WantedBy = [ "timers.target" ]; | ||||||
| }; | ||||||
| }; | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent recursive fallback when
fishtapeis missing.If
fishtapeis unavailable both locally and in the dev shell, Line 856 callsfish-test-dev, and Lines 877-880 immediately re-enterfish-testagain. That turns a missing dependency into recursive self-invocation instead of a single clear failure. Add a one-shot guard, or havefish-test-devinvoke a lower-level runner target directly.🛠️ Example guard
🤖 Prompt for AI Agents