Refactor nixos files relying on the old ipAddress / prefixLength / subnetMask attributes

This commit is contained in:
William A. Kennington III
2014-07-16 17:29:50 -05:00
parent 1ff4b83875
commit 86c0f8c549
6 changed files with 16 additions and 18 deletions

View File

@@ -48,10 +48,11 @@ rec {
let
interfacesNumbered = zipTwoLists config.virtualisation.vlans (range 1 255);
interfaces = flip map interfacesNumbered ({ first, second }:
nameValuePair "eth${toString second}"
{ ipAddress = "192.168.${toString first}.${toString m.second}";
subnetMask = "255.255.255.0";
});
nameValuePair "eth${toString second}" { ip4 =
[ { address = "192.168.${toString first}.${toString m.second}";
prefixLength = 24;
} ];
}
in
{ key = "ip-address";
config =
@@ -60,7 +61,7 @@ rec {
networking.interfaces = listToAttrs interfaces;
networking.primaryIPAddress =
optionalString (interfaces != []) (head interfaces).value.ipAddress;
optionalString (interfaces != []) (head (head interfaces).value.ip4).address;
# Put the IP addresses of all VMs in this machine's
# /etc/hosts file. If a machine has multiple