From d54fc20a69e5017feba2a7de7da1d100ae72dd29 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 13 Mar 2026 15:52:22 -0400 Subject: [PATCH] fix issue with ws develop shells being shared --- nix/devshell.nix | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/nix/devshell.nix b/nix/devshell.nix index 0147620..a77d094 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -327,19 +327,24 @@ let # Suppress macOS /etc/zshrc "locale: command not found" error echo 'locale() { :; }' > "$ZDOTDIR/.zshenv" + # Derive a unique tmux session name from the workspace root directory + # so each worktree/fork gets its own session + _ws_root="''${LOGOS_WORKSPACE_ROOT:-$(pwd)}" + _session_name="logos-$(echo "$_ws_root" | md5sum | cut -c1-8)" + # Launch tmux with zsh, or attach if session exists if command -v tmux &>/dev/null; then - if tmux has-session -t logos 2>/dev/null; then - exec tmux attach -t logos + if tmux has-session -t "$_session_name" 2>/dev/null; then + exec tmux attach -t "$_session_name" else - tmux -f ${tmuxConfig} new-session -d -s logos -n workspace - tmux set-environment -t logos ZDOTDIR "$ZDOTDIR" - tmux set-environment -t logos STARSHIP_CONFIG "${starshipConfig}" - tmux set-environment -t logos GIT_PAGER "delta --paging=always" - tmux set-environment -t logos DELTA_PAGER "less -R" - tmux set-environment -t logos LOGOS_WORKSPACE_ROOT "''${LOGOS_WORKSPACE_ROOT:-$(pwd)}" - tmux set-environment -t logos PATH "$PATH" - exec tmux attach -t logos + tmux -f ${tmuxConfig} new-session -d -s "$_session_name" -n workspace + tmux set-environment -t "$_session_name" ZDOTDIR "$ZDOTDIR" + tmux set-environment -t "$_session_name" STARSHIP_CONFIG "${starshipConfig}" + tmux set-environment -t "$_session_name" GIT_PAGER "delta --paging=always" + tmux set-environment -t "$_session_name" DELTA_PAGER "less -R" + tmux set-environment -t "$_session_name" LOGOS_WORKSPACE_ROOT "$_ws_root" + tmux set-environment -t "$_session_name" PATH "$PATH" + exec tmux attach -t "$_session_name" fi else exec ${pkgs.zsh}/bin/zsh