Revert "sshAuthSock: assert that at most one agent is enabled"

This reverts commit 9dc93220c1.

On one hand, conflicting definitions for `sshAuthSock.initialization.*`
were triggering before the assertion triggered, hereby making the
assertion redundant. On the other hand, the assertion prevents users
from running multiple agents side-by-side even after resolving the
definition conflict.

See https://github.com/nix-community/home-manager/pull/8533#issuecomment-4224165151.
This commit is contained in:
Benedikt Rips
2026-05-05 07:52:03 -05:00
committed by Austin Horstman
parent 7ef1c04d11
commit 5a15505146
3 changed files with 7 additions and 56 deletions
+7 -34
View File
@@ -63,38 +63,11 @@ in
type = with lib.types; nullOr (submodule initSubmodule);
};
config = lib.mkMerge [
{
assertions = [
{
assertion =
lib.count (x: x) [
(config.services.ssh-agent.enable || config.services.ssh-tpm-agent.enable)
(config.services.gpg-agent.enable && config.services.gpg-agent.enableSshSupport)
config.services.proton-pass-agent.enable
config.services.yubikey-agent.enable
] <= 1;
message = ''
Out of the SSH agents
- ssh-agent or ssh-tpm-agent (these two can coexist),
- gpg-agent with SSH support enabled, and
- proton-pass-agent,
- yubikey-agent,
at most one of them may be enabled (with the exception of ssh-agent and
ssh-tpm-agent).
'';
}
];
}
(lib.mkIf (cfg.initialization != null) {
# $SSH_AUTH_SOCK has to be set early since other tools rely on it
programs.bash.profileExtra = lib.mkOrder 900 bashIntegration;
programs.fish.shellInit = lib.mkOrder 900 fishIntegration;
programs.nushell.extraConfig = lib.mkOrder 900 nushellIntegration;
programs.zsh.envExtra = lib.mkOrder 900 bashIntegration;
})
];
config = lib.mkIf (cfg.initialization != null) {
# $SSH_AUTH_SOCK has to be set early since other tools rely on it
programs.bash.profileExtra = lib.mkOrder 900 bashIntegration;
programs.fish.shellInit = lib.mkOrder 900 fishIntegration;
programs.nushell.extraConfig = lib.mkOrder 900 nushellIntegration;
programs.zsh.envExtra = lib.mkOrder 900 bashIntegration;
};
}
@@ -1,21 +0,0 @@
{
services.gpg-agent = {
enable = true;
enableSshSupport = true;
};
services.ssh-agent.enable = true;
test.asserts.assertions.expected = [
''
Out of the SSH agents
- ssh-agent or ssh-tpm-agent (these two can coexist),
- gpg-agent with SSH support enabled, and
- proton-pass-agent,
- yubikey-agent,
at most one of them may be enabled (with the exception of ssh-agent and
ssh-tpm-agent).
''
];
}
@@ -1,4 +1,3 @@
{
sshAuthSock-conflicts = ./conflicts.nix;
sshAuthSock-initialization = ./initialization.nix;
}