fix: add ssh keys to agent for all hosts

This commit is contained in:
2026-02-07 12:00:07 +01:00
parent cb8ac3b848
commit 7f0726f443

View File

@@ -18,20 +18,25 @@ in
enable = true; enable = true;
enableDefaultConfig = false; enableDefaultConfig = false;
matchBlocks = lib.genAttrs hostsWithKeys ( matchBlocks =
hostname: lib.genAttrs hostsWithKeys (
let hostname:
hostConfig = outputs.nixosConfigurations.${hostname}.config; let
publicHostname = hostConfig.ssh.publicHostname; hostConfig = outputs.nixosConfigurations.${hostname}.config;
targetUser = hostConfig.ssh.username; inherit (hostConfig.ssh) publicHostname username;
in in
{ {
host = hostname; host = hostname;
user = targetUser; user = username;
} }
// lib.optionalAttrs (publicHostname != "") { // lib.optionalAttrs (publicHostname != "") {
hostname = publicHostname; hostname = publicHostname;
} }
); )
// {
"*" = {
addKeysToAgent = "yes";
};
};
}; };
} }