Files
home-manager/tests/modules/services/ssh-tpm-agent/ssh_auth_sock.nix
T
Benedikt RipsandAustin Horstman a61b22e323 ssh_auth_sock: init module
`$SSH_AUTH_SOCK` must not be set unconditionally through
'home.sessionVariables' since its value needs to be preserved if it
stems from a forwarded SSH agent. Hence, this commit establishes a
centralized, internal 'ssh_auth_sock.initialization' option for setting
`$SSH_AUTH_SOCK`. It checks whether its value has to be preserved and
injects the initialization code into the proper
'programs.(bash|fish|nushell|zsh).*' options.
2026-04-03 21:15:34 -05:00

23 lines
714 B
Nix

{
programs.bash.enable = true;
programs.fish.enable = true;
programs.nushell.enable = true;
programs.zsh.enable = true;
services.ssh-tpm-agent.enable = true;
nmt.script = ''
assertFileContains \
home-files/.profile \
'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-tpm-agent.sock"'
assertFileContains \
home-files/.config/fish/config.fish \
'set -x SSH_AUTH_SOCK "$XDG_RUNTIME_DIR/ssh-tpm-agent.sock"'
assertFileContains \
home-files/.config/nushell/config.nu \
'$env.SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-tpm-agent.sock"'
assertFileContains \
home-files/.zshenv \
'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-tpm-agent.sock"'
'';
}