* Expose networking.interfaces as an attribute set keyed on the

interface name through the derived option networking.ifaces.  This
  makes it easier to get information about specific interfaces
  (e.g. `nodes.router.config.networking.ifaces.eth2.ipAddress').
  Really networking.interfaces should be an attribute set.

svn path=/nixos/trunk/; revision=21938
This commit is contained in:
Eelco Dolstra 2010-05-21 14:12:03 +00:00
parent 3c7a6eb53c
commit fa183e5472
3 changed files with 16 additions and 4 deletions

View file

@ -117,6 +117,16 @@ in
};
networking.ifaces = mkOption {
default = listToAttrs
(map (iface: { name = iface.name; value = iface; }) config.networking.interfaces);
internal = true;
description = ''
The network interfaces in <option>networking.interfaces</option>
as an attribute set keyed on the interface name.
'';
};
};

View file

@ -42,10 +42,11 @@ in
};
client1 =
{ config, pkgs, ... }:
{ config, pkgs, nodes, ... }:
{ environment.systemPackages = [ pkgs.transmission ];
virtualisation.vlans = [ 2 ];
networking.defaultGateway = "192.168.2.3"; # !!! ugly
networking.defaultGateway =
nodes.router.config.networking.ifaces.eth2.ipAddress;
};
client2 =

View file

@ -10,9 +10,10 @@
nodes =
{ client =
{ config, pkgs, ... }:
{ config, pkgs, nodes, ... }:
{ virtualisation.vlans = [ 1 ];
networking.defaultGateway = "192.168.1.2"; # !!! ugly
networking.defaultGateway =
nodes.router.config.networking.ifaces.eth2.ipAddress;
};
router =