···8282 EDITOR = "hx";
8383 VISUAL = "hx";
8484 SUDO_EDITOR = "hx";
8585- SSH_AUTH_SOCK = "${config.home.homeDirectory}/.1password/agent.sock";
8685 SSH_ASKPASS = "${pkgs.openssh-askpass}/libexec/gtk-ssh-askpass";
8786 SSH_ASKPASS_REQUIRE = "prefer";
8887 };
8888+8989+ # Only point at the local 1Password agent when not inside an SSH
9090+ # session — otherwise we'd clobber the forwarded agent from `ssh -A`
9191+ # and lose access to the laptop's YubiKey.
9292+ home.sessionVariablesExtra = ''
9393+ if [ -z "$SSH_CONNECTION" ]; then
9494+ export SSH_AUTH_SOCK="${config.home.homeDirectory}/.1password/agent.sock"
9595+ fi
9696+ '';
89979098 # SSH allowed signers for commit signature verification
9199 home.file.".ssh/allowed_signers".text = ''
+6-2
modules/shell.nix
···8989 };
9090 interactiveShellInit = ''
9191 set fish_greeting
9292- # Set 1Password SSH agent socket
9393- set -gx SSH_AUTH_SOCK ${config.home.homeDirectory}/.1password/agent.sock
9292+ # Set 1Password SSH agent socket, but only when not inside an
9393+ # SSH session — otherwise preserve the forwarded agent from
9494+ # `ssh -A` so YubiKey signing keeps working on remote hosts.
9595+ if not set -q SSH_CONNECTION
9696+ set -gx SSH_AUTH_SOCK ${config.home.homeDirectory}/.1password/agent.sock
9797+ end
9498 # Load 1Password CLI plugins
9599 if test -f ~/.config/op/plugins.sh
96100 source ~/.config/op/plugins.sh