mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 19:49:45 +01:00
gpg-agent: always export SSH_AUTH_SOCK
When using GnuPG agent for SSH, it is necessary to export the SSH_AUTH_SOCK variable, otherwise, SSH will use the wrong agent socket.
This commit is contained in:
parent
ffe2d07e77
commit
fe9ef570fe
1 changed files with 4 additions and 1 deletions
|
@ -280,8 +280,11 @@ in {
|
||||||
"pinentry-program ${lib.getExe cfg.pinentryPackage}"
|
"pinentry-program ${lib.getExe cfg.pinentryPackage}"
|
||||||
++ [ cfg.extraConfig ]);
|
++ [ cfg.extraConfig ]);
|
||||||
|
|
||||||
|
# Make sure we export GnuPG agent socket for SSH
|
||||||
|
# https://www.gnupg.org/documentation/manuals/gnupg/Agent-Examples.html#Agent-Examples
|
||||||
home.sessionVariablesExtra = optionalString cfg.enableSshSupport ''
|
home.sessionVariablesExtra = optionalString cfg.enableSshSupport ''
|
||||||
if [[ -z "$SSH_AUTH_SOCK" ]]; then
|
unset SSH_AGENT_PID
|
||||||
|
if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||||
export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)"
|
export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue