network-interfaces module: optionSet -> submodule

This commit is contained in:
Eric Sagnes
2016-09-11 19:45:24 +09:00
parent 12a1de8305
commit 062928c3ad

View File

@@ -97,7 +97,7 @@ let
addrOpts = v:
assert v == 4 || v == 6;
{
{ options = {
address = mkOption {
type = types.str;
description = ''
@@ -114,6 +114,7 @@ let
'';
};
};
};
interfaceOpts = { name, ... }: {
@@ -141,8 +142,7 @@ let
{ address = "10.0.0.1"; prefixLength = 16; }
{ address = "192.168.1.1"; prefixLength = 24; }
];
type = types.listOf types.optionSet;
options = addrOpts 4;
type = with types; listOf (submodule (addrOpts 4));
description = ''
List of IPv4 addresses that will be statically assigned to the interface.
'';
@@ -154,8 +154,7 @@ let
{ address = "fdfd:b3f0:482::1"; prefixLength = 48; }
{ address = "2001:1470:fffd:2098::e006"; prefixLength = 64; }
];
type = types.listOf types.optionSet;
options = addrOpts 6;
type = with types; listOf (submodule (addrOpts 6));
description = ''
List of IPv6 addresses that will be statically assigned to the interface.
'';
@@ -415,8 +414,7 @@ in
<option>networking.useDHCP</option> is true, then every
interface not listed here will be configured using DHCP.
'';
type = types.loaOf types.optionSet;
options = [ interfaceOpts ];
type = with types; loaOf (submodule interfaceOpts);
};
networking.vswitches = mkOption {
@@ -434,7 +432,7 @@ in
interface.
'';
type = types.attrsOf types.optionSet;
type = with types; attrsOf (submodule {
options = {
@@ -482,6 +480,8 @@ in
};
});
};
networking.bridges = mkOption {
@@ -499,7 +499,7 @@ in
bridge's network interface.
'';
type = types.attrsOf types.optionSet;
type = with types; attrsOf (submodule {
options = {
@@ -519,6 +519,8 @@ in
};
});
};
networking.bonds = mkOption {
@@ -538,7 +540,7 @@ in
name specifying the name of the bond's network interface
'';
type = types.attrsOf types.optionSet;
type = with types; attrsOf (submodule {
options = {
@@ -593,10 +595,11 @@ in
};
};
});
};
networking.macvlans = mkOption {
type = types.attrsOf types.optionSet;
default = { };
example = literalExample {
wan = {
@@ -608,6 +611,7 @@ in
This option allows you to define macvlan interfaces which should
be automatically created.
'';
type = with types; attrsOf (submodule {
options = {
interface = mkOption {
@@ -624,10 +628,11 @@ in
};
};
});
};
networking.sits = mkOption {
type = types.attrsOf types.optionSet;
default = { };
example = literalExample {
hurricane = {
@@ -644,6 +649,7 @@ in
description = ''
This option allows you to define 6-to-4 interfaces which should be automatically created.
'';
type = with types; attrsOf (submodule {
options = {
remote = mkOption {
@@ -684,6 +690,8 @@ in
};
};
});
};
networking.vlans = mkOption {
@@ -706,7 +714,7 @@ in
specifying the name of the vlan interface.
'';
type = types.attrsOf types.optionSet;
type = with types; attrsOf (submodule {
options = {
@@ -723,6 +731,9 @@ in
};
};
});
};
networking.wlanInterfaces = mkOption {
@@ -760,7 +771,7 @@ in
would have to be created explicitly.
'';
type = types.attrsOf types.optionSet;
type = with types; attrsOf (submodule {
options = {
@@ -827,6 +838,9 @@ in
};
};
});
};
networking.useDHCP = mkOption {