summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-07-16 17:29:50 -0500
committerWilliam A. Kennington III <william@wkennington.com>2014-08-30 07:33:38 -0700
commit86c0f8c549c2ad728e06f8bc11d805fe760e7df8 (patch)
tree9c71752eb9b2a01e4173b598df7f68e9c8d7b496 /nixos
parent1ff4b838758f36dc8c54995e104dd17ba08a65a4 (diff)
downloadnixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar.gz
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar.bz2
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar.lz
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar.xz
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.tar.zst
nixpkgs-86c0f8c549c2ad728e06f8bc11d805fe760e7df8.zip
Refactor nixos files relying on the old ipAddress / prefixLength / subnetMask attributes
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/configuration/ipv4-config.xml5
-rw-r--r--nixos/lib/build-vms.nix11
-rw-r--r--nixos/modules/programs/virtualbox.nix2
-rw-r--r--nixos/modules/tasks/network-interfaces.nix8
-rw-r--r--nixos/tests/bittorrent.nix6
-rw-r--r--nixos/tests/nat.nix2
6 files changed, 16 insertions, 18 deletions
diff --git a/nixos/doc/manual/configuration/ipv4-config.xml b/nixos/doc/manual/configuration/ipv4-config.xml
index e2c51518349..053501b1736 100644
--- a/nixos/doc/manual/configuration/ipv4-config.xml
+++ b/nixos/doc/manual/configuration/ipv4-config.xml
@@ -12,12 +12,9 @@ interfaces.  However, you can configure an interface manually as
 follows:
 
 <programlisting>
-networking.interfaces.eth0 = { ipAddress = "192.168.1.2"; prefixLength = 24; };
+networking.interfaces.eth0.ip4 = [ { address = "192.168.1.2"; prefixLength = 24; } ];
 </programlisting>
 
-(The network prefix can also be specified using the option
-<literal>subnetMask</literal>,
-e.g. <literal>"255.255.255.0"</literal>, but this is deprecated.)
 Typically you’ll also want to set a default gateway and set of name
 servers:
 
diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix
index 498c0a37783..ba189555409 100644
--- a/nixos/lib/build-vms.nix
+++ b/nixos/lib/build-vms.nix
@@ -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
diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix
index e2dd76219eb..fec1a7b61f3 100644
--- a/nixos/modules/programs/virtualbox.nix
+++ b/nixos/modules/programs/virtualbox.nix
@@ -44,5 +44,5 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
         '';
     };
 
-  networking.interfaces.vboxnet0 = { ipAddress = "192.168.56.1"; prefixLength = 24; };
+  networking.interfaces.vboxnet0.ip4 = [ { address = "192.168.56.1"; prefixLength = 24; } ];
 }
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index e8c770d077c..054784502eb 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -254,10 +254,10 @@ in
     networking.interfaces = mkOption {
       default = {};
       example =
-        { eth0 = {
-            ipAddress = "131.211.84.78";
-            subnetMask = "255.255.255.128";
-          };
+        { eth0.ip4 = [ {
+            address = "131.211.84.78";
+            prefixLength = 25;
+          } ];
         };
       description = ''
         The configuration for each network interface.  If
diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix
index 002e012f65f..7eb9c215ee1 100644
--- a/nixos/tests/bittorrent.nix
+++ b/nixos/tests/bittorrent.nix
@@ -16,7 +16,7 @@ let
   miniupnpdConf = nodes: pkgs.writeText "miniupnpd.conf"
     ''
       ext_ifname=eth1
-      listening_ip=${nodes.router.config.networking.interfaces.eth2.ipAddress}/24
+      listening_ip=${(head nodes.router.config.networking.interfaces.eth2.ip4).address}/24
       allow 1024-65535 192.168.2.0/24 1024-65535
     '';
 
@@ -53,7 +53,7 @@ in
         { environment.systemPackages = [ pkgs.transmission ];
           virtualisation.vlans = [ 2 ];
           networking.defaultGateway =
-            nodes.router.config.networking.interfaces.eth2.ipAddress;
+            (head nodes.router.config.networking.interfaces.eth2.ip4).address;
           networking.firewall.enable = false;
         };
 
@@ -81,7 +81,7 @@ in
       # Create the torrent.
       $tracker->succeed("mkdir /tmp/data");
       $tracker->succeed("cp ${file} /tmp/data/test.tar.bz2");
-      $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -t http://${nodes.tracker.config.networking.interfaces.eth1.ipAddress}:6969/announce -o /tmp/test.torrent");
+      $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -t http://${(head nodes.tracker.config.networking.interfaces.eth1.ip4).address}:6969/announce -o /tmp/test.torrent");
       $tracker->succeed("chmod 644 /tmp/test.torrent");
 
       # Start the tracker.  !!! use a less crappy tracker
diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix
index 5fdcc0e97ca..5a57cce6b67 100644
--- a/nixos/tests/nat.nix
+++ b/nixos/tests/nat.nix
@@ -13,7 +13,7 @@ import ./make-test.nix {
         { virtualisation.vlans = [ 1 ];
           networking.firewall.allowPing = true;
           networking.defaultGateway =
-            nodes.router.config.networking.interfaces.eth2.ipAddress;
+            (head nodes.router.config.networking.interfaces.eth2.ip4).address;
         };
 
       router =