From 00696b23fafdf805915516f36df898413da10eed Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Fri, 20 Feb 2026 17:15:39 -0800 Subject: [PATCH] Updates --- dotfiles/config/mise/config.toml | 1 + dotfiles/gitignore | 3 +++ dotfiles/shenv | 28 ++++++++++++++++++++++++++++ dotfiles/ssh/rc | 12 +++++++----- dotfiles/zshrc.d/gpg.zsh | 11 +---------- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/dotfiles/config/mise/config.toml b/dotfiles/config/mise/config.toml index 4ef4de3..6bf448e 100644 --- a/dotfiles/config/mise/config.toml +++ b/dotfiles/config/mise/config.toml @@ -8,6 +8,7 @@ uvx = true uv_venv_auto = true [tools] +age = "latest" uv = "latest" [hooks] diff --git a/dotfiles/gitignore b/dotfiles/gitignore index 6c9310d..8ca0973 100644 --- a/dotfiles/gitignore +++ b/dotfiles/gitignore @@ -27,3 +27,6 @@ id_ed25519 # These files should basically never be committed .env + +# Mise local +mise.local.toml diff --git a/dotfiles/shenv b/dotfiles/shenv index ebdf810..bd30ce5 100755 --- a/dotfiles/shenv +++ b/dotfiles/shenv @@ -87,6 +87,34 @@ export LVM_SUPPRESS_FD_WARNINGS=1 # Default disable SSH forwarding in EARTHLY export EARTHLY_SSH_AUTH_SOCK="" +# Handle SSH_AUTH_SOCK for tmux consistency +_SSH_AUTH_LINK="${HOME}/.ssh/ssh_auth_sock" +if [ -z "${SSH_AUTH_SOCK:-}" ] || [ ! -S "${SSH_AUTH_SOCK}" ] ; then + # Try to find a working GPG agent SSH socket if no agent is set or current is broken + if command -v gpgconf >/dev/null 2>&1; then + _GPG_SSH_SOCK=$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null) + fi + # Fallback to common paths if gpgconf fails or isn't present + if [ -z "${_GPG_SSH_SOCK}" ] || [ ! -S "${_GPG_SSH_SOCK}" ]; then + _GPG_SSH_SOCK="${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent.ssh" + [ -S "$_GPG_SSH_SOCK" ] || _GPG_SSH_SOCK="/run/user/$(id -u)/gnupg/S.gpg-agent.ssh" + fi + + if [ -S "${_GPG_SSH_SOCK}" ] ; then + export SSH_AUTH_SOCK="$_GPG_SSH_SOCK" + fi + unset _GPG_SSH_SOCK +fi + +# If we have a valid socket but it's not our stable link, sync the link and use it. +# This ensures tmux (using the static path) always finds the most recent agent. +if [ -S "${SSH_AUTH_SOCK:-}" ] && [ "${SSH_AUTH_SOCK}" != "${_SSH_AUTH_LINK}" ] ; then + [ -d "$(dirname "${_SSH_AUTH_LINK}")" ] || mkdir -p "$(dirname "${_SSH_AUTH_LINK}")" + ln -sf "${SSH_AUTH_SOCK}" "${_SSH_AUTH_LINK}" + export SSH_AUTH_SOCK="${_SSH_AUTH_LINK}" +fi +unset _SSH_AUTH_LINK + # Setup XDG-like dirs on MacOS # Based on https://leebyron.com/til/mac-xdg/ if [ "$(uname)" = "Darwin" ] ; then diff --git a/dotfiles/ssh/rc b/dotfiles/ssh/rc index 225f0ba..0c605e8 100755 --- a/dotfiles/ssh/rc +++ b/dotfiles/ssh/rc @@ -8,11 +8,13 @@ REMOTE_LINK="${HOME}/.ssh/ssh_auth_sock" if [ -S "${SSH_AUTH_SOCK}" ] ; then SSH_REMOTE_AUTH_SOCK="${SSH_AUTH_SOCK}" export SSH_REMOTE_AUTH_SOCK - if [ "${1:-}" = "force" ] || [ ! -S "${REMOTE_LINK}" ] ; then - ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}" - SSH_AUTH_SOCK="${REMOTE_LINK}" - export SSH_AUTH_SOCK - fi + # Always update the symlink to the latest session's socket. + # This ensures that tmux (which uses the static path) always points to a + # current agent. + mkdir -p "$(dirname "${REMOTE_LINK}")" + ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}" + SSH_AUTH_SOCK="${REMOTE_LINK}" + export SSH_AUTH_SOCK fi # if stdin is a tty, don't do the cookie step diff --git a/dotfiles/zshrc.d/gpg.zsh b/dotfiles/zshrc.d/gpg.zsh index 018daf0..f36aefa 100644 --- a/dotfiles/zshrc.d/gpg.zsh +++ b/dotfiles/zshrc.d/gpg.zsh @@ -29,16 +29,7 @@ if grep -q '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then # Load required functions. autoload -Uz add-zsh-hook - if test -z "$SSH_AUTH_SOCK" ; then - SSH_AUTH_SOCK="/run/user/$(id -u)/gnupg/S.gpg-agent.ssh" - if test -S "$SSH_AUTH_SOCK" ; then - export SSH_AUTH_SOCK - else - unset SSH_AUTH_SOCK - fi - fi - - # Updates the GPG-Agent TTY before every command since SSH does not set it. +# Updates the GPG-Agent TTY before every command since SSH does not set it. function _gpg-agent-update-tty { gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null }