Journal 2023-02-02
<!-- Morning -->GPG Custom Home Nixos
If you configure a different $GNUPGHOME, the gpgconf --list-dirs tool will
return the socket directories as
/run/user/$(id)/gnupg/<hash>/S.gpg-agent.socket the directories. Where the
hash is the GCRY_MD_SHA1 hash of the GNUPGHOME.event.FootnoteReference
If your using NixOS option programs.gnupg.agent.enable the user service
will put the socket in the wrong path. You need to set the ListeningStream
to the correct path.
{
systemd.user.sockets.gpg-agent.listenStreams = [ "" "%t/gnupg/d.8jmbbcqh9gemi75at4554oo4/S.gpg-agent" ];
systemd.user.sockets.gpg-agent-ssh.listenStreams = [ "" "%t/gnupg/d.8jmbbcqh9gemi75at4554oo4/S.gpg-agent.ssh" ];
systemd.user.sockets.gpg-agent-extra.listenStreams = [ "" "%t/gnupg/d.8jmbbcqh9gemi75at4554oo4/S.gpg-agent.extra" ];
}
The first "" empty string is to reset the option for the override.
Then you can configure the environment variables as usual:
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)".
1
Source
[ArchWiki - GnuPG](https://wiki.archlinux.org/title/GnuPG#Set_SSH_AUTH_SOCK)