summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-08-26 17:03:46 +0200
committerAlan Pearce2017-08-26 17:03:46 +0200
commit63597f1375e7a70e9aa7405c99c61a602bda72dd (patch)
tree77107c3e80b81203a76a7ada3f3a3e47b1ffd2cc
parent1899ee2402cb3d9e816af5b5597c4611dc77684f (diff)
downloadnixfiles-63597f1375e7a70e9aa7405c99c61a602bda72dd.tar.lz
nixfiles-63597f1375e7a70e9aa7405c99c61a602bda72dd.tar.zst
nixfiles-63597f1375e7a70e9aa7405c99c61a602bda72dd.zip
zsh: Set SSH_AUTH_SOCK to GnuPG SSH agent socket
-rw-r--r--zsh/.config/zsh/.zshenv5
1 files changed, 3 insertions, 2 deletions
diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv
index f82d0a26..4f7b20f7 100644
--- a/zsh/.config/zsh/.zshenv
+++ b/zsh/.config/zsh/.zshenv
@@ -10,9 +10,10 @@ then
     . $ZDOTDIR/zshenv.private
   fi
 
-  if [[ -z $SSH_AUTH_SOCK ]]
+  unset SSH_AGENT_PID
+  if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]
   then
-    export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent
+    export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
   fi
 
   if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]]