Merge pull request 'modules: static hosts filter nonexistent ip' (#1398) from a-kenji-fix/path-loading into main

This commit is contained in:
clan-bot 2024-05-21 15:28:52 +00:00
commit bfe37c2457

View File

@ -18,7 +18,13 @@
name: _: !(lib.elem name config.clan.static-hosts.excludeHosts)
) machines;
in
(lib.mapAttrs' (
machine: _: lib.nameValuePair (builtins.readFile (zerotierIpMachinePath machine)) [ machine ]
) filteredMachines);
lib.filterAttrs (_: value: value != null) (
lib.mapAttrs' (
machine: _:
let
path = zerotierIpMachinePath machine;
in
if builtins.pathExists path then lib.nameValuePair (builtins.readFile path) [ machine ] else null
) filteredMachines
);
}