# Pastebin FCR5iIgh let pkgs = import {}; lib = pkgs.lib; data = { host-a = {ip = "1.1.1.1";}; host-b = {ip = "2.2.2.2";}; container = { host-c = {ip = "3.3.3.3";}; host-d = {ip = "4.4.4.4";}; }; }; build-hosts = sets: path: res: if sets ? ip then { "${sets.ip}" = (lib.concatStringsSep "-" path); } else lib.foldr (key: out: out // (build-hosts sets."${key}" (path ++ [key]) res) ) res (builtins.attrNames sets); in build-hosts data [] {}