Files
nixos-configuration/shared/base/modules/security/ssh.nix

29 lines
672 B
Nix
Raw Normal View History

# /nix/store/<hash>/etc/ssh/ssh_config & /nix/store/<hash>/etc/ssh/authorized_keys
{
2025-10-14 20:03:28 +02:00
lib,
systemConfig,
systems,
knownSystems,
common,
...
}:
let
2025-10-14 20:03:28 +02:00
allSystems = knownSystems // systems;
in
{
2025-10-14 20:03:28 +02:00
programs.ssh.knownHosts = builtins.mapAttrs (hostName: system: {
extraHostNames = [
(
if (system ? address && system.address ? tailnet) then
system.address.tailnet
else
common.tailnetAddr hostName
)
];
publicKey = system.ssh.publicKey;
}) allSystems;
users.users.${systemConfig.username}.openssh.authorizedKeys.keys = (
2025-10-14 20:03:28 +02:00
lib.mapAttrsToList (_hostName: system: system.ssh.publicKey) allSystems
);
}