diff --git a/nixos/roles/vmNetwork.nix b/nixos/roles/vmNetwork.nix index b0f78ec..c378af8 100644 --- a/nixos/roles/vmNetwork.nix +++ b/nixos/roles/vmNetwork.nix @@ -9,12 +9,12 @@ inherit (builtins) elem; hostmap = import ./hostmap.nix; myhostName = config.networking.hostName; - # We replace our own ip with 127.0.0.1 in /etc/hosts # To turn the hostmap around suitable for networking.hosts the following simple code almost works # concatMapAttrs (hostname: ipData: { ${ipData.ipv4} = [hostname]; }) hostmap # but breaks as soon as we want to map two different names to the same ip. # So the code looks uglier than one would expect. globalhosts = foldAttrs (a: b: a ++ b) [] (mapAttrsToList (hostname: ipData: {${ipData.ipv4} = [hostname];}) hostmap); + # We replace our own ip with 127.0.0.1 in /etc/hosts myhosts = concatMapAttrs (ip: hosts: if (elem myhostName hosts) # nixos maps the hostname to the loopback 127.0.0.2 by default, so we exclude it here.