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