Use SSH keys on NixOS

Generate Ed25519 SSH key:

ssh-keygen -t ed25519

[...]
Your public key has been saved in /path/.ssh/id_ed25519.pub.

Get your public SSH key:

cat /path/.ssh/id_ed25519.pub

ssh-ed25519 AAAA[...] user@host

Edit configuration.nix:

users.extraUsers.user = {
    openssh.authorizedKeys.keys = [
        "ssh-ed25519 AAAA[...] user@host"
    ];
};