fix/tmux resurrect nixos - #1529
Conversation
- Move plugin options to per-plugin extraConfig in default.nix so they are set before each plugin's run-shell - Move status-right to continuum extraConfig so continuum can prepend its auto-save trigger (#(.../continuum_save.sh)) - Fix _two_function to create tmux server before resolving resurrect restore script path (was always empty after reboot) - Switch grep -E to grep -P for tab matching in post-save hook
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughConfiguration refactoring moves tmux plugin options from static Changes
Sequence DiagramsequenceDiagram
participant Fish as Fish Function
participant Bootstrap as _bootstrap<br/>tmux server
participant ShowOpts as tmux show-options
participant ListKeys as tmux list-keys
participant Resurrect as Resurrect<br/>Restore Script
rect rgba(200, 150, 255, 0.5)
Note over Fish,Resurrect: Old Flow (eager detection)
Fish->>ListKeys: Query `@resurrect-restore-script-path`
activate ListKeys
ListKeys-->>Fish: path or fallback
deactivate ListKeys
Fish->>Resurrect: Execute restore
end
rect rgba(150, 200, 255, 0.5)
Note over Fish,Resurrect: New Flow (deferred detection)
Fish->>Bootstrap: Start _bootstrap tmux server<br/>(if no sessions exist)
activate Bootstrap
Bootstrap-->>Fish: Server ready
deactivate Bootstrap
Fish->>ShowOpts: Query `@resurrect-restore-script-path`
activate ShowOpts
ShowOpts-->>Fish: path or empty
deactivate ShowOpts
alt Option set
Fish->>Resurrect: Execute restore
else Option empty
Fish->>ListKeys: Fall back to list-keys lookup
activate ListKeys
ListKeys-->>Fish: path
deactivate ListKeys
Fish->>Resurrect: Execute restore
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mesa DescriptionTL;DRFixes tmux resurrect/continuum restore on NixOS. What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request refactors the tmux configuration by migrating plugin-specific settings from tmux.conf to default.nix using Home Manager's plugin attribute sets. It also updates the _two_function.fish script to more reliably locate the tmux-resurrect restore script by checking tmux options before falling back to key bindings. Feedback was provided to harden the resurrect-hook-post-save-all hook by using absolute Nix store paths for system utilities like grep and readlink, ensuring the hook remains robust across different environments.
| extraConfig = '' | ||
| set -g @resurrect-capture-pane-contents 'on' | ||
| set -g @resurrect-processes 'btop fish git' | ||
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -P "^(pane|window)\twork\t" "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' |
There was a problem hiding this comment.
The resurrect-hook-post-save-all hook is somewhat fragile as it relies on the user's PATH for commands like grep, readlink, and mv. In a Nix environment, it's more robust to use absolute paths from pkgs. Additionally, using $HOME instead of ~ and adding a check for the existence of the last symlink improves reliability.
set -g @resurrect-hook-post-save-all 'd=$HOME/.tmux/resurrect; [ -L "$d/last" ] && f="$d/$(${pkgs.coreutils}/bin/readlink "$d/last")" && ${pkgs.gnugrep}/bin/grep -P "^(pane|window)\twork\t" "$f" > "$f.tmp" && ${pkgs.coreutils}/bin/printf "state\twork\n" >> "$f.tmp" && ${pkgs.coreutils}/bin/mv "$f.tmp" "$f"'
* fix: tmux resurrect/continuum restore on NixOS - Move plugin options to per-plugin extraConfig in default.nix so they are set before each plugin's run-shell - Move status-right to continuum extraConfig so continuum can prepend its auto-save trigger (#(.../continuum_save.sh)) - Fix _two_function to create tmux server before resolving resurrect restore script path (was always empty after reboot) - Switch grep -E to grep -P for tab matching in post-save hook * fix: load resurrect before continuum in plugin order
* chore(deps): lock file maintenance Signed-off-by: * chore(deps): update dependency mempalace to >=3.2.0 (#1525) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#1526) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix/tmux resurrect nixos (#1529) * fix: tmux resurrect/continuum restore on NixOS - Move plugin options to per-plugin extraConfig in default.nix so they are set before each plugin's run-shell - Move status-right to continuum extraConfig so continuum can prepend its auto-save trigger (#(.../continuum_save.sh)) - Fix _two_function to create tmux server before resolving resurrect restore script path (was always empty after reboot) - Switch grep -E to grep -P for tab matching in post-save hook * fix: load resurrect before continuum in plugin order * chore(deps): update dotagents digest to dc0fdc0 (#1527) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#1528) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#1530) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mistral-vibe to >=2.7.5 (#1531) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update rust crate worktrunk to 0.37.0 (#1532) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#1533) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: remap framework copy for editors (#1534) * fix: remap framework copy for editors * chore: update * chore: update * chore: update * chore: update * chore: update * fix(keyd): centralize app mapper config Move the Slack app mapper config into the shared keyd module so the host does not inline repo config paths. Keep the keyd application mapper service in the shared module and preserve the sg keyd launch path that fixes Slack Framework+C in stale user sessions. Co-authored-by: Codex <noreply@openai.com> * ref(home-manager): move keyd app mapper service Move the keyd application mapper user unit into the Home Manager services tree so service wiring follows the repo's shared service layout. Keep config/keyd focused on keyd config and enable the mapper through an explicit Home Manager service option so the service can consume app.conf without recursive evaluation. Co-authored-by: Codex <noreply@openai.com> * ref(keyd): simplify app mapper wiring Write app.conf from the shared keyd module again and keep the Home Manager service focused on the user unit. Have the service read the standard xdg config path instead of carrying a configFile option, while keeping the restart hash tied to the resolved app.conf source. Co-authored-by: Codex <noreply@openai.com> --------- Co-authored-by: Codex <noreply@openai.com> * fix: use extraLuaConfig instead of home.file for nvim init.lua * fix: replace removed nodePackages with top-level packages * fix: remove vllm from nix packages (managed via pyproject.toml) --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <renovate@whitesourcesoftware.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com>
Summary by cubic
Fixes reliable
tmuxsession restore on NixOS by loadingresurrectbeforecontinuumand resolving the restore script after the server starts. Moves plugin options into per-pluginextraConfigso hooks run with the correct settings and letscontinuummanagestatus-right.Bug Fixes
_two_function.fishso plugins load, then read@resurrect-restore-script-path(fallback to key scan) and run restore.resurrectbeforecontinuumto enable auto-restore.grep -Pin the post-save hook to correctly match tab-separated fields.Refactors
tmux.confto per-pluginextraConfigindefault.nix(resurrect,continuum,extrakto,tmux-thumbs,tmux-sessionx).status-rightand its length incontinuumextraConfigso it can prepend its save trigger; remove duplicates fromtmux.conf.Written for commit fcec1ba. Summary will update on new commits.