From 2caa83753721f480380e1e44dac28c9c26fe89e3 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 29 May 2024 19:32:47 +0200 Subject: [PATCH] Add top level domain option for zerotier machines. --- clanModules/static-hosts/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/clanModules/static-hosts/default.nix b/clanModules/static-hosts/default.nix index 028dda876..34d7059b9 100644 --- a/clanModules/static-hosts/default.nix +++ b/clanModules/static-hosts/default.nix @@ -6,6 +6,11 @@ default = [ config.clanCore.machineName ]; description = "Hosts that should be excluded"; }; + topLevelDomain = lib.mkOption { + type = lib.types.str; + default = ""; + description = "Top level domain to reach hosts"; + }; }; config.networking.hosts = @@ -24,7 +29,15 @@ let path = zerotierIpMachinePath machine; in - if builtins.pathExists path then lib.nameValuePair (builtins.readFile path) [ machine ] else null + if builtins.pathExists path then + lib.nameValuePair (builtins.readFile path) ( + if (config.clan.static-hosts.topLevelDomain == "") then + [ machine ] + else + [ "${machine}.${config.clan.static-hosts.topLevelDomain}" ] + ) + else + null ) filteredMachines ); }