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;
enableDefaultConfig = false;
matchBlocks = lib.genAttrs hostsWithKeys (
hostname:
let
hostConfig = outputs.nixosConfigurations.${hostname}.config;
publicHostname = hostConfig.ssh.publicHostname;
targetUser = hostConfig.ssh.username;
in
{
host = hostname;
user = targetUser;
}
// lib.optionalAttrs (publicHostname != "") {
hostname = publicHostname;
}
);
matchBlocks =
lib.genAttrs hostsWithKeys (
hostname:
let
hostConfig = outputs.nixosConfigurations.${hostname}.config;
inherit (hostConfig.ssh) publicHostname username;
in
{
host = hostname;
user = username;
}
// lib.optionalAttrs (publicHostname != "") {
hostname = publicHostname;
}
)
// {
"*" = {
addKeysToAgent = "yes";
};
};
};
}