2025-05-19 21:51:12 +02:00
|
|
|
# /nix/store/<hash>/etc/ssh/ssh_config & /nix/store/<hash>/etc/ssh/authorized_keys
|
|
|
|
{
|
|
|
|
systemConfig,
|
|
|
|
systems,
|
|
|
|
common,
|
|
|
|
...
|
|
|
|
}:
|
2025-05-19 21:42:29 +02:00
|
|
|
with builtins;
|
|
|
|
let
|
2025-05-19 21:51:12 +02:00
|
|
|
domain = "dns.${common.domain}";
|
2025-05-19 21:42:29 +02:00
|
|
|
allSystems = systems ++ [
|
2025-05-15 21:14:05 +02:00
|
|
|
{
|
2025-05-19 21:42:29 +02:00
|
|
|
hostName = "homelab";
|
|
|
|
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIARDv5nRlfPDXdV+Db4FaqeSJZ3/3MO0frYGzuVeqYAl";
|
|
|
|
}
|
2025-05-19 20:23:04 +02:00
|
|
|
];
|
2025-05-19 21:42:29 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
programs.ssh.knownHosts = listToAttrs (
|
|
|
|
map (system: {
|
|
|
|
name = system.hostName;
|
|
|
|
value = {
|
|
|
|
extraHostNames = [ "${system.hostName}.${domain}" ];
|
|
|
|
publicKey = system.ssh.publicKey;
|
|
|
|
};
|
|
|
|
}) allSystems
|
|
|
|
);
|
|
|
|
users.users.${systemConfig.username}.openssh.authorizedKeys.keys = (
|
|
|
|
map (system: system.ssh.publicKey) allSystems
|
|
|
|
);
|
2025-05-15 21:14:05 +02:00
|
|
|
}
|