Merge pull request 'Add top level domain option for zerotier machines.' (#1499) from mrvandalo/clan-core:feature/static-host-tld into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1499
This commit is contained in:
@@ -6,6 +6,11 @@
|
|||||||
default = [ config.clanCore.machineName ];
|
default = [ config.clanCore.machineName ];
|
||||||
description = "Hosts that should be excluded";
|
description = "Hosts that should be excluded";
|
||||||
};
|
};
|
||||||
|
topLevelDomain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
description = "Top level domain to reach hosts";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.networking.hosts =
|
config.networking.hosts =
|
||||||
@@ -24,7 +29,15 @@
|
|||||||
let
|
let
|
||||||
path = zerotierIpMachinePath machine;
|
path = zerotierIpMachinePath machine;
|
||||||
in
|
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
|
) filteredMachines
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user