From 098fc2c41eb78dfb5ab925bae025db1e1bf2c1a3 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Tue, 15 Jul 2025 13:40:21 +0200 Subject: [PATCH] Improve SSH life on Linux with Keychain and Tmux agent forwarding, now resembles Mac experience. --- nix/home/linux.nix | 12 ++++++++++++ tmux/tmux.conf | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/nix/home/linux.nix b/nix/home/linux.nix index 0f077fc..03f1dee 100644 --- a/nix/home/linux.nix +++ b/nix/home/linux.nix @@ -34,6 +34,16 @@ in ./common/firefox.nix ]; + programs = { + zsh.initContent = '' + # Just ensure SSH agent is available, don't preload keys + if [ ! -S ~/.ssh/ssh_auth_sock ]; then + ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock 2>/dev/null + fi + export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock + ''; + }; + home = { packages = with pkgs; [ pythonEnv @@ -55,11 +65,13 @@ in sway-audio-idle-inhibit ffmpeg imv + keychain ]; file = utils.mk_symlinks { inherit config dotfiles; }; }; services = { mako.enable = true; + ssh-agent.enable = true; }; } diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 9453f65..edb3948 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -130,9 +130,9 @@ set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh)" set -g status-bg "#171B24" set -g status-style bold -# set -g @catppuccin_flavour "macchiato" -# set -g @catppuccin_status_background "#1e2030" -# set -g @plugin "catppuccin/tmux" +# SSH agent forwarding +set-option -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION" +setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock set -g @plugin "tmux-plugins/tpm" run "~/dev/git/tpm/tpm"