From 9bfca72823a8294dde2ffdb8db26bf724f09b49c Mon Sep 17 00:00:00 2001 From: Lauren Lagarde Date: Tue, 15 Jul 2025 21:21:23 -0500 Subject: [PATCH] Improve ssh-with-yubikey alias --- home-manager/programs/bash.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home-manager/programs/bash.nix b/home-manager/programs/bash.nix index 2ae8bde..89f39ad 100644 --- a/home-manager/programs/bash.nix +++ b/home-manager/programs/bash.nix @@ -2,7 +2,10 @@ programs.bash = { enable = true; shellAliases = { - ssh-with-yubikey = "ssh -A -R \"$(gpgconf --list-dirs agent-socket):$(gpgconf --list-dirs agent-socket)\" -o \"StreamLocalBindUnlink=yes\""; + ssh-with-yubikey = "ssh_with_yubikey"; }; + bashrcExtra = '' + ssh_with_yubikey () { AGENT_SOCKET=$(ssh $@ gpgconf --list-dirs agent-socket) && ssh -A -R "$AGENT_SOCKET:$(gpgconf --list-dirs agent-socket)" -o "StreamLocalBindUnlink=yes" $@; } + ''; }; }