From fdeb6d65054503cdc5bca250b8e9565a37c8d148 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Tue, 14 Apr 2026 11:05:08 +0200 Subject: [PATCH] (fix) zsh: fix ssh-agent location for remote zsh sessions --- files/shell/.shellrc.alias | 2 +- patches/ssh-agent-location.patch | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/files/shell/.shellrc.alias b/files/shell/.shellrc.alias index 16b7a2e..2dcfb44 100644 --- a/files/shell/.shellrc.alias +++ b/files/shell/.shellrc.alias @@ -25,7 +25,7 @@ alias nupdate="nix-channel --update" alias typix="nix flake init --refresh -t github:loqusion/typix" alias twatch="typst watch" alias tbuild="tpst build" -alias tlsp="nix-shell -p tinymist --command zsh" +alias tlsp="nix-shell -p tinymist" alias nlatex="nix-shell -p texlive.combined.scheme-full" diff --git a/patches/ssh-agent-location.patch b/patches/ssh-agent-location.patch index 8b2951b..155c4ef 100644 --- a/patches/ssh-agent-location.patch +++ b/patches/ssh-agent-location.patch @@ -1,5 +1,5 @@ diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh -index 8354864..61462fd 100644 +index 83548648..42ec378f 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -24,7 +24,7 @@ function _start_agent() { @@ -11,3 +11,13 @@ index 8354864..61462fd 100644 chmod 600 "$ssh_env_cache" . "$ssh_env_cache" > /dev/null } +@@ -107,7 +107,8 @@ if zstyle -t :omz:plugins:ssh-agent agent-forwarding \ + fi + fi + else +- _start_agent ++ # Don't start new one, if ssh-agent is forwarded ++ [[ $SSH_AUTH_SOCK =~ ^"/tmp/ssh-" ]] || _start_agent + fi + + # Don't add identities if lazy-loading is enabled