How enable ssh-agent in gpg-agent launched by systemd?

I’m trying to run gpg-agent with SSH agent support, but it fails to listen on ssh socket.

I enabled systemd gpg-agent-ssh.socket target and the socket file is visible in my /run/users/$PID/gnupg/S.gpg-agent.ssh.

However, trying to contact results in connection refused:

% ssh-add -L
Error connecting to agent: Connection refused

I can see in logs that it still doesn’t listen for ssh agent connections:

2025-01-26 16:46:09 gpg-agent[245644] gpg-agent (GnuPG) 2.4.5 starting in supervised mode.
2025-01-26 16:46:09 gpg-agent[245644] using fd 3 for std socket (/run/user/xxx/gnupg/S.gpg-agent)
2025-01-26 16:46:09 gpg-agent[245644] listening on: std=3 extra=-1 browser=-1 ssh=-1
2025-01-26 16:47:13 gpg-agent[245644] socket is still served by this server

It concerns me that the unit file uses deprecated option.

How do I enable ssh support properly?

I do not know the answer but…
Have a look at how the ssh-agent user services is written for clues.
Did write a gpg-agent for ssh service yourself?

Make sure to specify SSH_AUTH_SOCK in your environment configuration:
How to enable SSH access using a GPG key for authentication | Opensource.com