nixos-config/components/network/sshd/known-hosts-zerotier.nix
Ingolf Wagner 159a1e2740
upgrade
2024-06-26 03:00:17 +02:00

35 lines
799 B
Nix

{ lib, config, clanLib, ... }:
with lib;
with types;
let
machines = clanLib.allMachineNames;
publicKey = clanLib.readFact "ssh.id_ed25519.pub";
tld = config.clan.static-hosts.topLevelDomain;
knownHosts = lib.genAttrs machines
(machine:
{
hostNames = [
"[${machine}]:2222"
"[${machine}.${tld}]:2222"
"[${machine}.private]:2222"
"${machine}"
"${machine}.${tld}"
"${machine}.private"
];
publicKey = publicKey machine;
}
);
in
{
options.components.network.zerotier = {
enable = mkOption {
type = bool;
default = false; # todo : properly set this
};
};
config = mkIf config.components.network.zerotier.enable {
services.openssh.knownHosts = knownHosts;
};
}