···1919 enable = true;
2020 # Sets up the gpg-agent-ssh.socket unit so gpg-agent (running in
2121 # --supervised mode) actually receives an ssh listen fd. The module
2222- # also exports SSH_AUTH_SOCK in environment.extraInit, which we
2323- # don't want system-wide — unset it again below so users opt in via:
2222+ # also exports SSH_AUTH_SOCK in environment.extraInit (only if unset),
2323+ # which we don't want as the system-wide default — undo exactly that
2424+ # export below, leaving other agents (tpm2.nix) alone; users opt in via:
2425 # SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" ssh ...
2526 enableSSHSupport = true;
2627 };
27282829 environment.extraInit = lib.mkAfter ''
2929- unset SSH_AUTH_SOCK
3030+ case "''${SSH_AUTH_SOCK:-}" in
3131+ */gnupg/S.gpg-agent.ssh) unset SSH_AUTH_SOCK ;;
3232+ esac
3033 '';
3134}