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

16 lines
400 B
Nix

# /nix/store/<hash>/etc/ssh/ssh_config & /nix/store/<hash>/etc/ssh/authorized_keys
{
lib,
systemConfig,
systems,
...
}:
{
programs.ssh.knownHosts = builtins.mapAttrs (hostName: system: {
publicKey = system.ssh.publicKey;
}) systems;
users.users.${systemConfig.username}.openssh.authorizedKeys.keys = (
lib.mapAttrsToList (_hostName: system: system.ssh.publicKey) systems
);
}