nixos-config/components/network/sshd/known-hosts-zerotier.nix

36 lines
799 B
Nix
Raw Normal View History

{ lib, config, clanLib, ... }:
2024-06-26 03:00:17 +02:00
with lib;
with types;
2024-06-06 01:48:15 +02:00
let
machines = clanLib.allMachineNames;
publicKey = clanLib.readFact "ssh.id_ed25519.pub";
2024-06-06 01:48:15 +02:00
tld = config.clan.static-hosts.topLevelDomain;
knownHosts = lib.genAttrs machines
(machine:
2024-06-06 01:48:15 +02:00
{
hostNames = [
"[${machine}]:2222"
"[${machine}.${tld}]:2222"
"[${machine}.private]:2222"
"${machine}"
"${machine}.${tld}"
"${machine}.private"
2024-06-06 01:48:15 +02:00
];
publicKey = publicKey machine;
2024-06-06 01:48:15 +02:00
}
);
2024-06-06 01:48:15 +02:00
in
{
2024-06-26 03:00:17 +02:00
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;
};
2024-06-06 01:48:15 +02:00
}