2023-01-20 07:07:45 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
{
|
2023-01-27 03:18:49 +00:00
|
|
|
# give each host a shortname that all the other hosts know, to allow easy comms.
|
2023-11-24 07:35:58 +00:00
|
|
|
networking.hosts = lib.mkMerge (builtins.map
|
|
|
|
(host: let
|
|
|
|
cfg = config.sane.hosts.by-name."${host}";
|
|
|
|
in {
|
|
|
|
"${cfg.lan-ip}" = [ host ];
|
|
|
|
} // lib.optionalAttrs (cfg.wg-home.ip != null) {
|
|
|
|
"${cfg.wg-home.ip}" = [ "${host}-hn" ];
|
|
|
|
})
|
|
|
|
(builtins.attrNames config.sane.hosts.by-name)
|
|
|
|
);
|
2023-01-20 07:07:45 +00:00
|
|
|
}
|