git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #18511 from ericsagnes/feat/remove-optionSet

modules: optionSet -> submodule

commit7e80c42b0ead918defafb92893c605983319e418 authorJoachim F <joachifm@users.noreply.github.com> dateSat 1 Oct 2016, 17:57 (10 years ago) parent46693bdf923905
28 files changed+1083−1090
lib/types.nix+1−1 nixos/modules/config/users-groups.nix+30−30 nixos/modules/security/acme.nix+1−2 nixos/modules/security/pam.nix+1−2 nixos/modules/services/backup/bacula.nix+3−6 nixos/modules/services/hardware/sane_extra_backends/brscan4.nix+2−3 nixos/modules/services/logging/logcheck.nix+35−33 nixos/modules/services/misc/rippled.nix+38−40 nixos/modules/services/monitoring/smartd.nix+1−2 nixos/modules/services/monitoring/ups.nix+1−2 nixos/modules/services/network-filesystems/tahoe.nix+131−129 nixos/modules/services/networking/i2pd.nix+27−28 nixos/modules/services/networking/nat.nix+15−15 nixos/modules/services/networking/openvpn.nix+40−38 nixos/modules/services/networking/prosody.nix+1−2 nixos/modules/services/networking/ssh/sshd.nix+18−17 nixos/modules/services/networking/supplicant.nix+101−102 nixos/modules/services/networking/tinc.nix+86−84 nixos/modules/services/networking/xinetd.nix+64−62 nixos/modules/services/web-servers/winstone.nix+1−2 nixos/modules/services/web-servers/zope2.nix+1−2 nixos/modules/system/boot/loader/grub/grub.nix+43−43 nixos/modules/system/boot/luksroot.nix+152−152 nixos/modules/system/boot/networkd.nix+8−13 nixos/modules/system/boot/systemd.nix+16−26 nixos/modules/system/etc/etc.nix+3−3 nixos/modules/tasks/network-interfaces.nix+261−247 nixos/modules/virtualisation/containers.nix+2−4
lib/types.nix+1−1
@@ -261,7 +261,7 @@ rec {
261261 # declarations from the ‘options’ attribute of containing option
262262 # declaration.
263263 optionSet = mkOptionType {
264− name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set";
264+ name = builtins.trace "types.optionSet is deprecated; use types.submodule instead" "option set";
265265 };
266266
267267 # Augment the given type with an additional type check function.
nixos/modules/config/users-groups.nix+30−30
@@ -131,13 +131,12 @@ let
131131 };
132132
133133 subUidRanges = mkOption {
134− type = types.listOf types.optionSet;
134+ type = with types; listOf (submodule subordinateUidRange);
135135 default = [];
136136 example = [
137137 { startUid = 1000; count = 1; }
138138 { startUid = 100001; count = 65534; }
139139 ];
140− options = [ subordinateUidRange ];
141140 description = ''
142141 Subordinate user ids that user is allowed to use.
143142 They are set into <filename>/etc/subuid</filename> and are used
@@ -146,13 +145,12 @@ let
146145 };
147146
148147 subGidRanges = mkOption {
149− type = types.listOf types.optionSet;
148+ type = with types; listOf (submodule subordinateGidRange);
150149 default = [];
151150 example = [
152151 { startGid = 100; count = 1; }
153152 { startGid = 1001; count = 999; }
154153 ];
155− options = [ subordinateGidRange ];
156154 description = ''
157155 Subordinate group ids that user is allowed to use.
158156 They are set into <filename>/etc/subgid</filename> and are used
@@ -310,32 +308,36 @@ let
310308 };
311309
312310 subordinateUidRange = {
313− startUid = mkOption {
314− type = types.int;
315− description = ''
316− Start of the range of subordinate user ids that user is
317− allowed to use.
318− '';
319− };
320− count = mkOption {
321− type = types.int;
322− default = 1;
323− description = ''Count of subordinate user ids'';
311+ options = {
312+ startUid = mkOption {
313+ type = types.int;
314+ description = ''
315+ Start of the range of subordinate user ids that user is
316+ allowed to use.
317+ '';
318+ };
319+ count = mkOption {
320+ type = types.int;
321+ default = 1;
322+ description = ''Count of subordinate user ids'';
323+ };
324324 };
325325 };
326326
327327 subordinateGidRange = {
328− startGid = mkOption {
329− type = types.int;
330− description = ''
331− Start of the range of subordinate group ids that user is
332− allowed to use.
333− '';
334− };
335− count = mkOption {
336− type = types.int;
337− default = 1;
338− description = ''Count of subordinate group ids'';
328+ options = {
329+ startGid = mkOption {
330+ type = types.int;
331+ description = ''
332+ Start of the range of subordinate group ids that user is
333+ allowed to use.
334+ '';
335+ };
336+ count = mkOption {
337+ type = types.int;
338+ default = 1;
339+ description = ''Count of subordinate group ids'';
340+ };
339341 };
340342 };
341343
@@ -428,7 +430,7 @@ in {
428430
429431 users.users = mkOption {
430432 default = {};
431− type = types.loaOf types.optionSet;
433+ type = with types; loaOf (submodule userOpts);
432434 example = {
433435 alice = {
434436 uid = 1234;
@@ -444,7 +446,6 @@ in {
444446 Additional user accounts to be created automatically by the system.
445447 This can also be used to set options for root.
446448 '';
447− options = [ userOpts ];
448449 };
449450
450451 users.groups = mkOption {
@@ -453,11 +454,10 @@ in {
453454 { students.gid = 1001;
454455 hackers = { };
455456 };
456− type = types.loaOf types.optionSet;
457+ type = with types; loaOf (submodule groupOpts);
457458 description = ''
458459 Additional groups to be created automatically by the system.
459460 '';
460− options = [ groupOpts ];
461461 };
462462
463463 # FIXME: obsolete - will remove.
nixos/modules/security/acme.nix+1−2
@@ -129,11 +129,10 @@ in
129129
130130 certs = mkOption {
131131 default = { };
132− type = types.loaOf types.optionSet;
132+ type = with types; loaOf (submodule certOpts);
133133 description = ''
134134 Attribute set of certificates to get signed and renewed.
135135 '';
136− options = [ certOpts ];
137136 example = {
138137 "example.com" = {
139138 webroot = "/var/www/challenges/";
nixos/modules/security/pam.nix+1−2
@@ -386,8 +386,7 @@ in
386386
387387 security.pam.services = mkOption {
388388 default = [];
389− type = types.loaOf types.optionSet;
390− options = [ pamOpts ];
389+ type = with types; loaOf (submodule pamOpts);
391390 description =
392391 ''
393392 This option defines the PAM services. A service typically
nixos/modules/services/backup/bacula.nix+3−6
@@ -198,8 +198,7 @@ in {
198198 description = ''
199199 This option defines director resources in Bacula File Daemon.
200200 '';
201− type = types.attrsOf types.optionSet;
202− options = [ directorOptions ];
201+ type = with types; attrsOf (submodule directorOptions);
203202 };
204203
205204 extraClientConfig = mkOption {
@@ -253,8 +252,7 @@ in {
253252 description = ''
254253 This option defines Director resources in Bacula Storage Daemon.
255254 '';
256− type = types.attrsOf types.optionSet;
257− options = [ directorOptions ];
255+ type = with types; attrsOf (submodule directorOptions);
258256 };
259257
260258 device = mkOption {
@@ -262,8 +260,7 @@ in {
262260 description = ''
263261 This option defines Device resources in Bacula Storage Daemon.
264262 '';
265− type = types.attrsOf types.optionSet;
266− options = [ deviceOptions ];
263+ type = with types; attrsOf (submodule deviceOptions);
267264 };
268265
269266 extraStorageConfig = mkOption {
nixos/modules/services/hardware/sane_extra_backends/brscan4.nix+2−3
@@ -81,12 +81,11 @@ in
8181 { office1 = { model = "MFC-7860DW"; ip = "192.168.1.2"; };
8282 office2 = { model = "MFC-7860DW"; nodename = "BRW0080927AFBCE"; };
8383 };
84− type = types.loaOf types.optionSet;
84+ type = with types; loaOf (submodule netDeviceOpts);
8585 description = ''
8686 The list of network devices that will be registered against the brscan4
8787 sane backend.
8888 '';
89− options = [ netDeviceOpts ];
9089 };
9190 };
9291
@@ -113,4 +112,4 @@ in
113112 ];
114113
115114 };
116−}
115+}
nixos/modules/services/logging/logcheck.nix+35−33
@@ -62,42 +62,46 @@ let
6262 };
6363
6464 ignoreOptions = {
65− level = levelOption;
65+ options = {
66+ level = levelOption;
6667
67− regex = mkOption {
68− default = "";
69− type = types.str;
70− description = ''
71− Regex specifying which log lines to ignore.
72− '';
68+ regex = mkOption {
69+ default = "";
70+ type = types.str;
71+ description = ''
72+ Regex specifying which log lines to ignore.
73+ '';
74+ };
7375 };
7476 };
7577
7678 ignoreCronOptions = {
77− user = mkOption {
78− default = "root";
79− type = types.str;
80− description = ''
81− User that runs the cronjob.
82− '';
83− };
79+ options = {
80+ user = mkOption {
81+ default = "root";
82+ type = types.str;
83+ description = ''
84+ User that runs the cronjob.
85+ '';
86+ };
8487
85− cmdline = mkOption {
86− default = "";
87− type = types.str;
88− description = ''
89− Command line for the cron job. Will be turned into a regex for the logcheck ignore rule.
90− '';
91− };
88+ cmdline = mkOption {
89+ default = "";
90+ type = types.str;
91+ description = ''
92+ Command line for the cron job. Will be turned into a regex for the logcheck ignore rule.
93+ '';
94+ };
9295
93− timeArgs = mkOption {
94− default = null;
95− type = types.nullOr (types.str);
96− example = "02 06 * * *";
97− description = ''
98− "min hr dom mon dow" crontab time args, to auto-create a cronjob too.
99− Leave at null to not do this and just add a logcheck ignore rule.
100− '';
96+ timeArgs = mkOption {
97+ default = null;
98+ type = types.nullOr (types.str);
99+ example = "02 06 * * *";
100+ description = ''
101+ "min hr dom mon dow" crontab time args, to auto-create a cronjob too.
102+ Leave at null to not do this and just add a logcheck ignore rule.
103+ '';
104+ };
101105 };
102106 };
103107
@@ -180,8 +184,7 @@ in
180184 description = ''
181185 This option defines extra ignore rules.
182186 '';
183− type = types.loaOf types.optionSet;
184− options = [ ignoreOptions ];
187+ type = with types; loaOf (submodule ignoreOptions);
185188 };
186189
187190 ignoreCron = mkOption {
@@ -189,8 +192,7 @@ in
189192 description = ''
190193 This option defines extra ignore rules for cronjobs.
191194 '';
192− type = types.loaOf types.optionSet;
193− options = [ ignoreOptions ignoreCronOptions ];
195+ type = with types; loaOf (submodule ignoreCronOptions);
194196 };
195197
196198 extraGroups = mkOption {
nixos/modules/services/misc/rippled.nix+38−40
@@ -154,43 +154,45 @@ let
154154 };
155155
156156 dbOptions = {
157− type = mkOption {
158− description = "Rippled database type.";
159− type = types.enum ["rocksdb" "nudb"];
160− default = "rocksdb";
161− };
157+ options = {
158+ type = mkOption {
159+ description = "Rippled database type.";
160+ type = types.enum ["rocksdb" "nudb"];
161+ default = "rocksdb";
162+ };
162163
163− path = mkOption {
164− description = "Location to store the database.";
165− type = types.path;
166− default = cfg.databasePath;
167− };
164+ path = mkOption {
165+ description = "Location to store the database.";
166+ type = types.path;
167+ default = cfg.databasePath;
168+ };
168169
169− compression = mkOption {
170− description = "Whether to enable snappy compression.";
171− type = types.nullOr types.bool;
172− default = null;
173− };
170+ compression = mkOption {
171+ description = "Whether to enable snappy compression.";
172+ type = types.nullOr types.bool;
173+ default = null;
174+ };
174175
175− onlineDelete = mkOption {
176− description = "Enable automatic purging of older ledger information.";
177− type = types.addCheck (types.nullOr types.int) (v: v > 256);
178− default = cfg.ledgerHistory;
179− };
176+ onlineDelete = mkOption {
177+ description = "Enable automatic purging of older ledger information.";
178+ type = types.addCheck (types.nullOr types.int) (v: v > 256);
179+ default = cfg.ledgerHistory;
180+ };
180181
181− advisoryDelete = mkOption {
182− description = ''
183− If set, then require administrative RPC call "can_delete"
184− to enable online deletion of ledger records.
185− '';
186− type = types.nullOr types.bool;
187− default = null;
188− };
182+ advisoryDelete = mkOption {
183+ description = ''
184+ If set, then require administrative RPC call "can_delete"
185+ to enable online deletion of ledger records.
186+ '';
187+ type = types.nullOr types.bool;
188+ default = null;
189+ };
189190
190− extraOpts = mkOption {
191− description = "Extra database options.";
192− type = types.lines;
193− default = "";
191+ extraOpts = mkOption {
192+ description = "Extra database options.";
193+ type = types.lines;
194+ default = "";
195+ };
194196 };
195197 };
196198
@@ -213,8 +215,7 @@ in
213215
214216 ports = mkOption {
215217 description = "Ports exposed by rippled";
216− type = types.attrsOf types.optionSet;
217− options = [portOptions];
218+ type = with types; attrsOf (submodule portOptions);
218219 default = {
219220 rpc = {
220221 port = 5005;
@@ -238,8 +239,7 @@ in
238239
239240 nodeDb = mkOption {
240241 description = "Rippled main database options.";
241− type = types.nullOr types.optionSet;
242− options = dbOptions;
242+ type = with types; nullOr (submodule dbOptions);
243243 default = {
244244 type = "rocksdb";
245245 extraOpts = ''
@@ -254,15 +254,13 @@ in
254254
255255 tempDb = mkOption {
256256 description = "Rippled temporary database options.";
257− type = types.nullOr types.optionSet;
258− options = dbOptions;
257+ type = with types; nullOr (submodule dbOptions);
259258 default = null;
260259 };
261260
262261 importDb = mkOption {
263262 description = "Settings for performing a one-time import.";
264− type = types.nullOr types.optionSet;
265− options = dbOptions;
263+ type = with types; nullOr (submodule dbOptions);
266264 default = null;
267265 };
268266
nixos/modules/services/monitoring/smartd.nix+1−2
@@ -197,8 +197,7 @@ in
197197 devices = mkOption {
198198 default = [];
199199 example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
200− type = types.listOf types.optionSet;
201− options = [ smartdOpts ];
200+ type = with types; listOf (submodule smartdOpts);
202201 description = "List of devices to monitor.";
203202 };
204203
nixos/modules/services/monitoring/ups.nix+1−2
@@ -169,8 +169,7 @@ in
169169 monitoring directly. These are usually attached to serial ports,
170170 but USB devices are also supported.
171171 '';
172− type = types.attrsOf types.optionSet;
173− options = [ upsOptions ];
172+ type = with types; attrsOf (submodule upsOptions);
174173 };
175174
176175 };
nixos/modules/services/network-filesystems/tahoe.nix+131−129
@@ -8,148 +8,150 @@ in
88 options.services.tahoe = {
99 introducers = mkOption {
1010 default = {};
11− type = types.loaOf types.optionSet;
11+ type = with types; loaOf (submodule {
12+ options = {
13+ nickname = mkOption {
14+ type = types.str;
15+ description = ''
16+ The nickname of this Tahoe introducer.
17+ '';
18+ };
19+ tub.port = mkOption {
20+ default = 3458;
21+ type = types.int;
22+ description = ''
23+ The port on which the introducer will listen.
24+ '';
25+ };
26+ tub.location = mkOption {
27+ default = null;
28+ type = types.nullOr types.str;
29+ description = ''
30+ The external location that the introducer should listen on.
31+
32+ If specified, the port should be included.
33+ '';
34+ };
35+ package = mkOption {
36+ default = pkgs.tahoelafs;
37+ defaultText = "pkgs.tahoelafs";
38+ type = types.package;
39+ example = literalExample "pkgs.tahoelafs";
40+ description = ''
41+ The package to use for the Tahoe LAFS daemon.
42+ '';
43+ };
44+ };
45+ });
1246 description = ''
1347 The Tahoe introducers.
1448 '';
15− options = {
16− nickname = mkOption {
17− type = types.str;
18− description = ''
19− The nickname of this Tahoe introducer.
20− '';
21− };
22− tub.port = mkOption {
23− default = 3458;
24− type = types.int;
25− description = ''
26− The port on which the introducer will listen.
27− '';
28− };
29− tub.location = mkOption {
30− default = null;
31− type = types.nullOr types.str;
32− description = ''
33− The external location that the introducer should listen on.
34−
35− If specified, the port should be included.
36− '';
37− };
38− package = mkOption {
39− default = pkgs.tahoelafs;
40− defaultText = "pkgs.tahoelafs";
41− type = types.package;
42− example = literalExample "pkgs.tahoelafs";
43− description = ''
44− The package to use for the Tahoe LAFS daemon.
45− '';
46− };
47− };
4849 };
4950 nodes = mkOption {
5051 default = {};
51− type = types.loaOf types.optionSet;
52− description = ''
53− The Tahoe nodes.
54− '';
55− options = {
56− nickname = mkOption {
57− type = types.str;
58− description = ''
59− The nickname of this Tahoe node.
60− '';
61− };
62− tub.port = mkOption {
63− default = 3457;
64− type = types.int;
65− description = ''
66− The port on which the tub will listen.
52+ type = with types; loaOf (submodule {
53+ options = {
54+ nickname = mkOption {
55+ type = types.str;
56+ description = ''
57+ The nickname of this Tahoe node.
58+ '';
59+ };
60+ tub.port = mkOption {
61+ default = 3457;
62+ type = types.int;
63+ description = ''
64+ The port on which the tub will listen.
6765
68− This is the correct setting to tweak if you want Tahoe's storage
69− system to listen on a different port.
70− '';
71− };
72− tub.location = mkOption {
73− default = null;
74− type = types.nullOr types.str;
75− description = ''
76− The external location that the node should listen on.
66+ This is the correct setting to tweak if you want Tahoe's storage
67+ system to listen on a different port.
68+ '';
69+ };
70+ tub.location = mkOption {
71+ default = null;
72+ type = types.nullOr types.str;
73+ description = ''
74+ The external location that the node should listen on.
7775
78− This is the setting to tweak if there are multiple interfaces
79− and you want to alter which interface Tahoe is advertising.
76+ This is the setting to tweak if there are multiple interfaces
77+ and you want to alter which interface Tahoe is advertising.
8078
81− If specified, the port should be included.
82− '';
83− };
84− web.port = mkOption {
85− default = 3456;
86− type = types.int;
87− description = ''
88− The port on which the Web server will listen.
79+ If specified, the port should be included.
80+ '';
81+ };
82+ web.port = mkOption {
83+ default = 3456;
84+ type = types.int;
85+ description = ''
86+ The port on which the Web server will listen.
8987
90− This is the correct setting to tweak if you want Tahoe's WUI to
91− listen on a different port.
92− '';
93− };
94− client.introducer = mkOption {
95− default = null;
96− type = types.nullOr types.str;
97− description = ''
98− The furl for a Tahoe introducer node.
88+ This is the correct setting to tweak if you want Tahoe's WUI to
89+ listen on a different port.
90+ '';
91+ };
92+ client.introducer = mkOption {
93+ default = null;
94+ type = types.nullOr types.str;
95+ description = ''
96+ The furl for a Tahoe introducer node.
9997
100− Like all furls, keep this safe and don't share it.
101− '';
102− };
103− client.helper = mkOption {
104− default = null;
105− type = types.nullOr types.str;
106− description = ''
107− The furl for a Tahoe helper node.
98+ Like all furls, keep this safe and don't share it.
99+ '';
100+ };
101+ client.helper = mkOption {
102+ default = null;
103+ type = types.nullOr types.str;
104+ description = ''
105+ The furl for a Tahoe helper node.
108106
109− Like all furls, keep this safe and don't share it.
110− '';
111− };
112− client.shares.needed = mkOption {
113− default = 3;
114− type = types.int;
115− description = ''
116− The number of shares required to reconstitute a file.
117− '';
118− };
119− client.shares.happy = mkOption {
120− default = 7;
121− type = types.int;
122− description = ''
123− The number of distinct storage nodes required to store
124− a file.
125− '';
126− };
127− client.shares.total = mkOption {
128− default = 10;
129− type = types.int;
130− description = ''
131− The number of shares required to store a file.
132− '';
133− };
134− storage.enable = mkEnableOption "storage service";
135− storage.reservedSpace = mkOption {
136− default = "1G";
137− type = types.str;
138− description = ''
139− The amount of filesystem space to not use for storage.
140− '';
141− };
142− helper.enable = mkEnableOption "helper service";
143− package = mkOption {
144− default = pkgs.tahoelafs;
145− defaultText = "pkgs.tahoelafs";
146− type = types.package;
147− example = literalExample "pkgs.tahoelafs";
148− description = ''
149− The package to use for the Tahoe LAFS daemon.
150− '';
107+ Like all furls, keep this safe and don't share it.
108+ '';
109+ };
110+ client.shares.needed = mkOption {
111+ default = 3;
112+ type = types.int;
113+ description = ''
114+ The number of shares required to reconstitute a file.
115+ '';
116+ };
117+ client.shares.happy = mkOption {
118+ default = 7;
119+ type = types.int;
120+ description = ''
121+ The number of distinct storage nodes required to store
122+ a file.
123+ '';
124+ };
125+ client.shares.total = mkOption {
126+ default = 10;
127+ type = types.int;
128+ description = ''
129+ The number of shares required to store a file.
130+ '';
131+ };
132+ storage.enable = mkEnableOption "storage service";
133+ storage.reservedSpace = mkOption {
134+ default = "1G";
135+ type = types.str;
136+ description = ''
137+ The amount of filesystem space to not use for storage.
138+ '';
139+ };
140+ helper.enable = mkEnableOption "helper service";
141+ package = mkOption {
142+ default = pkgs.tahoelafs;
143+ defaultText = "pkgs.tahoelafs";
144+ type = types.package;
145+ example = literalExample "pkgs.tahoelafs";
146+ description = ''
147+ The package to use for the Tahoe LAFS daemon.
148+ '';
149+ };
151150 };
152− };
151+ });
152+ description = ''
153+ The Tahoe nodes.
154+ '';
153155 };
154156 };
155157 config = mkMerge [
nixos/modules/services/networking/i2pd.nix+27−28
@@ -187,44 +187,43 @@ in
187187
188188 outTunnels = mkOption {
189189 default = {};
190− type = with types; loaOf optionSet;
190+ type = with types; loaOf (submodule (
191+ { name, config, ... }: {
192+ options = commonTunOpts name;
193+ config = {
194+ name = mkDefault name;
195+ };
196+ }
197+ ));
191198 description = ''
192199 Connect to someone as a client and establish a local accept endpoint
193200 '';
194− options = [ ({ name, config, ... }: {
195− options = commonTunOpts name;
196− config = {
197− name = mkDefault name;
198− };
199− }) ];
200201 };
201202
202203 inTunnels = mkOption {
203204 default = {};
204− type = with types; loaOf optionSet;
205+ type = with types; loaOf (submodule (
206+ { name, config, ... }: {
207+ options = {
208+ inPort = mkOption {
209+ type = types.int;
210+ default = 0;
211+ description = "Service port. Default to the tunnel's listen port.";
212+ };
213+ accessList = mkOption {
214+ type = with types; listOf str;
215+ default = [];
216+ description = "I2P nodes that are allowed to connect to this service.";
217+ };
218+ } // commonTunOpts name;
219+ config = {
220+ name = mkDefault name;
221+ };
222+ }
223+ ));
205224 description = ''
206225 Serve something on I2P network at port and delegate requests to address inPort.
207226 '';
208− options = [ ({ name, config, ... }: {
209−
210− options = {
211− inPort = mkOption {
212− type = types.int;
213− default = 0;
214− description = "Service port. Default to the tunnel's listen port.";
215− };
216− accessList = mkOption {
217− type = with types; listOf str;
218− default = [];
219− description = "I2P nodes that are allowed to connect to this service.";
220− };
221− } // commonTunOpts name;
222−
223− config = {
224− name = mkDefault name;
225− };
226−
227− }) ];
228227 };
229228 };
230229 };
nixos/modules/services/networking/nat.nix+15−15
@@ -122,23 +122,23 @@ in
122122 };
123123
124124 networking.nat.forwardPorts = mkOption {
125− type = types.listOf types.optionSet;
125+ type = with types; listOf (submodule {
126+ options = {
127+ sourcePort = mkOption {
128+ type = types.int;
129+ example = 8080;
130+ description = "Source port of the external interface";
131+ };
132+
133+ destination = mkOption {
134+ type = types.str;
135+ example = "10.0.0.1:80";
136+ description = "Forward tcp connection to destination ip:port";
137+ };
138+ };
139+ });
126140 default = [];
127141 example = [ { sourcePort = 8080; destination = "10.0.0.1:80"; } ];
128− options = {
129− sourcePort = mkOption {
130− type = types.int;
131− example = 8080;
132− description = "Source port of the external interface";
133− };
134−
135− destination = mkOption {
136− type = types.str;
137− example = "10.0.0.1:80";
138− description = "Forward tcp connection to destination ip:port";
139− };
140− };
141−
142142 description =
143143 ''
144144 List of forwarded ports from the external interface to
nixos/modules/services/networking/openvpn.nix+40−38
@@ -116,52 +116,54 @@ in
116116 attribute name.
117117 '';
118118
119− type = types.attrsOf types.optionSet;
119+ type = with types; attrsOf (submodule {
120120
121− options = {
121+ options = {
122122
123− config = mkOption {
124− type = types.lines;
125− description = ''
126− Configuration of this OpenVPN instance. See
127− <citerefentry><refentrytitle>openvpn</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128− for details.
129− '';
130− };
123+ config = mkOption {
124+ type = types.lines;
125+ description = ''
126+ Configuration of this OpenVPN instance. See
127+ <citerefentry><refentrytitle>openvpn</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128+ for details.
129+ '';
130+ };
131131
132− up = mkOption {
133− default = "";
134− type = types.lines;
135− description = ''
136− Shell commands executed when the instance is starting.
137− '';
138− };
132+ up = mkOption {
133+ default = "";
134+ type = types.lines;
135+ description = ''
136+ Shell commands executed when the instance is starting.
137+ '';
138+ };
139139
140− down = mkOption {
141− default = "";
142− type = types.lines;
143− description = ''
144− Shell commands executed when the instance is shutting down.
145− '';
146− };
140+ down = mkOption {
141+ default = "";
142+ type = types.lines;
143+ description = ''
144+ Shell commands executed when the instance is shutting down.
145+ '';
146+ };
147147
148− autoStart = mkOption {
149− default = true;
150− type = types.bool;
151− description = "Whether this OpenVPN instance should be started automatically.";
152− };
148+ autoStart = mkOption {
149+ default = true;
150+ type = types.bool;
151+ description = "Whether this OpenVPN instance should be started automatically.";
152+ };
153+
154+ updateResolvConf = mkOption {
155+ default = false;
156+ type = types.bool;
157+ description = ''
158+ Use the script from the update-resolv-conf package to automatically
159+ update resolv.conf with the DNS information provided by openvpn. The
160+ script will be run after the "up" commands and before the "down" commands.
161+ '';
162+ };
153163
154− updateResolvConf = mkOption {
155− default = false;
156− type = types.bool;
157− description = ''
158− Use the script from the update-resolv-conf package to automatically
159− update resolv.conf with the DNS information provided by openvpn. The
160− script will be run after the "up" commands and before the "down" commands.
161− '';
162164 };
163165
164− };
166+ });
165167
166168 };
167169
nixos/modules/services/networking/prosody.nix+1−2
@@ -164,7 +164,7 @@ in
164164
165165 description = "Define the virtual hosts";
166166
167− type = types.loaOf types.optionSet;
167+ type = with types; loaOf (submodule vHostOpts);
168168
169169 example = {
170170 myhost = {
@@ -180,7 +180,6 @@ in
180180 };
181181 };
182182
183− options = [ vHostOpts ];
184183 };
185184
186185 ssl = mkOption {
nixos/modules/services/networking/ssh/sshd.nix+18−17
@@ -129,7 +129,24 @@ in
129129 };
130130
131131 listenAddresses = mkOption {
132− type = types.listOf types.optionSet;
132+ type = with types; listOf (submodule {
133+ options = {
134+ addr = mkOption {
135+ type = types.nullOr types.str;
136+ default = null;
137+ description = ''
138+ Host, IPv4 or IPv6 address to listen to.
139+ '';
140+ };
141+ port = mkOption {
142+ type = types.nullOr types.int;
143+ default = null;
144+ description = ''
145+ Port to listen to.
146+ '';
147+ };
148+ };
149+ });
133150 default = [];
134151 example = [ { addr = "192.168.3.1"; port = 22; } { addr = "0.0.0.0"; port = 64022; } ];
135152 description = ''
@@ -140,22 +157,6 @@ in
140157 NOTE: setting this option won't automatically enable given ports
141158 in firewall configuration.
142159 '';
143− options = {
144− addr = mkOption {
145− type = types.nullOr types.str;
146− default = null;
147− description = ''
148− Host, IPv4 or IPv6 address to listen to.
149− '';
150− };
151− port = mkOption {
152− type = types.nullOr types.int;
153− default = null;
154− description = ''
155− Port to listen to.
156− '';
157− };
158− };
159160 };
160161
161162 passwordAuthentication = mkOption {
nixos/modules/services/networking/supplicant.nix+101−102
@@ -75,7 +75,107 @@ in
7575 options = {
7676
7777 networking.supplicant = mkOption {
78− type = types.attrsOf types.optionSet;
78+ type = with types; attrsOf (submodule {
79+ options = {
80+
81+ configFile = {
82+
83+ path = mkOption {
84+ type = types.path;
85+ example = literalExample "/etc/wpa_supplicant.conf";
86+ description = ''
87+ External <literal>wpa_supplicant.conf</literal> configuration file.
88+ The configuration options defined declaratively within <literal>networking.supplicant</literal> have
89+ precedence over options defined in <literal>configFile</literal>.
90+ '';
91+ };
92+
93+ writable = mkOption {
94+ type = types.bool;
95+ default = false;
96+ description = ''
97+ Whether the configuration file at <literal>configFile.path</literal> should be written to by
98+ <literal>wpa_supplicant</literal>.
99+ '';
100+ };
101+
102+ };
103+
104+ extraConf = mkOption {
105+ type = types.lines;
106+ default = "";
107+ example = ''
108+ ap_scan=1
109+ device_name=My-NixOS-Device
110+ device_type=1-0050F204-1
111+ driver_param=use_p2p_group_interface=1
112+ disable_scan_offload=1
113+ p2p_listen_reg_class=81
114+ p2p_listen_channel=1
115+ p2p_oper_reg_class=81
116+ p2p_oper_channel=1
117+ manufacturer=NixOS
118+ model_name=NixOS_Unstable
119+ model_number=2015
120+ '';
121+ description = ''
122+ Configuration options for <literal>wpa_supplicant.conf</literal>.
123+ Options defined here have precedence over options in <literal>configFile</literal>.
124+ NOTE: Do not write sensitive data into <literal>extraConf</literal> as it will
125+ be world-readable in the <literal>nix-store</literal>. For sensitive information
126+ use the <literal>configFile</literal> instead.
127+ '';
128+ };
129+
130+ extraCmdArgs = mkOption {
131+ type = types.str;
132+ default = "";
133+ example = "-e/var/run/wpa_supplicant/entropy.bin";
134+ description =
135+ "Command line arguments to add when executing <literal>wpa_supplicant</literal>.";
136+ };
137+
138+ driver = mkOption {
139+ type = types.nullOr types.str;
140+ default = "nl80211,wext";
141+ description = "Force a specific wpa_supplicant driver.";
142+ };
143+
144+ bridge = mkOption {
145+ type = types.str;
146+ default = "";
147+ description = "Name of the bridge interface that wpa_supplicant should listen at.";
148+ };
149+
150+ userControlled = {
151+
152+ enable = mkOption {
153+ type = types.bool;
154+ default = false;
155+ description = ''
156+ Allow normal users to control wpa_supplicant through wpa_gui or wpa_cli.
157+ This is useful for laptop users that switch networks a lot and don't want
158+ to depend on a large package such as NetworkManager just to pick nearby
159+ access points.
160+ '';
161+ };
162+
163+ socketDir = mkOption {
164+ type = types.str;
165+ default = "/var/run/wpa_supplicant";
166+ description = "Directory of sockets for controlling wpa_supplicant.";
167+ };
168+
169+ group = mkOption {
170+ type = types.str;
171+ default = "wheel";
172+ example = "network";
173+ description = "Members of this group can control wpa_supplicant.";
174+ };
175+
176+ };
177+ };
178+ });
79179
80180 default = { };
81181
@@ -109,107 +209,6 @@ in
109209 service that can be accessed through <literal>D-Bus</literal>.
110210 '';
111211
112− options = {
113−
114− configFile = {
115−
116− path = mkOption {
117− type = types.path;
118− example = literalExample "/etc/wpa_supplicant.conf";
119− description = ''
120− External <literal>wpa_supplicant.conf</literal> configuration file.
121− The configuration options defined declaratively within <literal>networking.supplicant</literal> have
122− precedence over options defined in <literal>configFile</literal>.
123− '';
124− };
125−
126− writable = mkOption {
127− type = types.bool;
128− default = false;
129− description = ''
130− Whether the configuration file at <literal>configFile.path</literal> should be written to by
131− <literal>wpa_supplicant</literal>.
132− '';
133− };
134−
135− };
136−
137− extraConf = mkOption {
138− type = types.lines;
139− default = "";
140− example = ''
141− ap_scan=1
142− device_name=My-NixOS-Device
143− device_type=1-0050F204-1
144− driver_param=use_p2p_group_interface=1
145− disable_scan_offload=1
146− p2p_listen_reg_class=81
147− p2p_listen_channel=1
148− p2p_oper_reg_class=81
149− p2p_oper_channel=1
150− manufacturer=NixOS
151− model_name=NixOS_Unstable
152− model_number=2015
153− '';
154− description = ''
155− Configuration options for <literal>wpa_supplicant.conf</literal>.
156− Options defined here have precedence over options in <literal>configFile</literal>.
157− NOTE: Do not write sensitive data into <literal>extraConf</literal> as it will
158− be world-readable in the <literal>nix-store</literal>. For sensitive information
159− use the <literal>configFile</literal> instead.
160− '';
161− };
162−
163− extraCmdArgs = mkOption {
164− type = types.str;
165− default = "";
166− example = "-e/var/run/wpa_supplicant/entropy.bin";
167− description =
168− "Command line arguments to add when executing <literal>wpa_supplicant</literal>.";
169− };
170−
171− driver = mkOption {
172− type = types.nullOr types.str;
173− default = "nl80211,wext";
174− description = "Force a specific wpa_supplicant driver.";
175− };
176−
177− bridge = mkOption {
178− type = types.str;
179− default = "";
180− description = "Name of the bridge interface that wpa_supplicant should listen at.";
181− };
182−
183− userControlled = {
184−
185− enable = mkOption {
186− type = types.bool;
187− default = false;
188− description = ''
189− Allow normal users to control wpa_supplicant through wpa_gui or wpa_cli.
190− This is useful for laptop users that switch networks a lot and don't want
191− to depend on a large package such as NetworkManager just to pick nearby
192− access points.
193− '';
194− };
195−
196− socketDir = mkOption {
197− type = types.str;
198− default = "/var/run/wpa_supplicant";
199− description = "Directory of sockets for controlling wpa_supplicant.";
200− };
201−
202− group = mkOption {
203− type = types.str;
204− default = "wheel";
205− example = "network";
206− description = "Members of this group can control wpa_supplicant.";
207− };
208−
209− };
210−
211− };
212−
213212 };
214213
215214 };
nixos/modules/services/networking/tinc.nix+86−84
@@ -18,94 +18,96 @@ in
1818
1919 networks = mkOption {
2020 default = { };
21− type = types.loaOf types.optionSet;
21+ type = with types; loaOf (submodule {
22+ options = {
23+
24+ extraConfig = mkOption {
25+ default = "";
26+ type = types.lines;
27+ description = ''
28+ Extra lines to add to the tinc service configuration file.
29+ '';
30+ };
31+
32+ name = mkOption {
33+ default = null;
34+ type = types.nullOr types.str;
35+ description = ''
36+ The name of the node which is used as an identifier when communicating
37+ with the remote nodes in the mesh. If null then the hostname of the system
38+ is used.
39+ '';
40+ };
41+
42+ ed25519PrivateKeyFile = mkOption {
43+ default = null;
44+ type = types.nullOr types.path;
45+ description = ''
46+ Path of the private ed25519 keyfile.
47+ '';
48+ };
49+
50+ debugLevel = mkOption {
51+ default = 0;
52+ type = types.addCheck types.int (l: l >= 0 && l <= 5);
53+ description = ''
54+ The amount of debugging information to add to the log. 0 means little
55+ logging while 5 is the most logging. <command>man tincd</command> for
56+ more details.
57+ '';
58+ };
59+
60+ hosts = mkOption {
61+ default = { };
62+ type = types.loaOf types.lines;
63+ description = ''
64+ The name of the host in the network as well as the configuration for that host.
65+ This name should only contain alphanumerics and underscores.
66+ '';
67+ };
68+
69+ interfaceType = mkOption {
70+ default = "tun";
71+ type = types.addCheck types.str (n: n == "tun" || n == "tap");
72+ description = ''
73+ The type of virtual interface used for the network connection
74+ '';
75+ };
76+
77+ listenAddress = mkOption {
78+ default = null;
79+ type = types.nullOr types.str;
80+ description = ''
81+ The ip adress to bind to.
82+ '';
83+ };
84+
85+ package = mkOption {
86+ type = types.package;
87+ default = pkgs.tinc_pre;
88+ defaultText = "pkgs.tinc_pre";
89+ description = ''
90+ The package to use for the tinc daemon's binary.
91+ '';
92+ };
93+
94+ chroot = mkOption {
95+ default = true;
96+ type = types.bool;
97+ description = ''
98+ Change process root directory to the directory where the config file is located (/etc/tinc/netname/), for added security.
99+ The chroot is performed after all the initialization is done, after writing pid files and opening network sockets.
100+
101+ Note that tinc can't run scripts anymore (such as tinc-down or host-up), unless it is setup to be runnable inside chroot environment.
102+ '';
103+ };
104+ };
105+ });
106+
22107 description = ''
23108 Defines the tinc networks which will be started.
24109 Each network invokes a different daemon.
25110 '';
26− options = {
27−
28− extraConfig = mkOption {
29− default = "";
30− type = types.lines;
31− description = ''
32− Extra lines to add to the tinc service configuration file.
33− '';
34− };
35−
36− name = mkOption {
37− default = null;
38− type = types.nullOr types.str;
39− description = ''
40− The name of the node which is used as an identifier when communicating
41− with the remote nodes in the mesh. If null then the hostname of the system
42− is used.
43− '';
44− };
45−
46− ed25519PrivateKeyFile = mkOption {
47− default = null;
48− type = types.nullOr types.path;
49− description = ''
50− Path of the private ed25519 keyfile.
51− '';
52− };
53−
54− debugLevel = mkOption {
55− default = 0;
56− type = types.addCheck types.int (l: l >= 0 && l <= 5);
57− description = ''
58− The amount of debugging information to add to the log. 0 means little
59− logging while 5 is the most logging. <command>man tincd</command> for
60− more details.
61− '';
62− };
63−
64− hosts = mkOption {
65− default = { };
66− type = types.loaOf types.lines;
67− description = ''
68− The name of the host in the network as well as the configuration for that host.
69− This name should only contain alphanumerics and underscores.
70− '';
71− };
72−
73− interfaceType = mkOption {
74− default = "tun";
75− type = types.addCheck types.str (n: n == "tun" || n == "tap");
76− description = ''
77− The type of virtual interface used for the network connection
78− '';
79− };
80−
81− listenAddress = mkOption {
82− default = null;
83− type = types.nullOr types.str;
84− description = ''
85− The ip adress to bind to.
86− '';
87− };
88−
89− package = mkOption {
90− type = types.package;
91− default = pkgs.tinc_pre;
92− defaultText = "pkgs.tinc_pre";
93− description = ''
94− The package to use for the tinc daemon's binary.
95− '';
96− };
97−
98− chroot = mkOption {
99− default = true;
100− type = types.bool;
101− description = ''
102− Change process root directory to the directory where the config file is located (/etc/tinc/netname/), for added security.
103− The chroot is performed after all the initialization is done, after writing pid files and opening network sockets.
104−
105− Note that tinc can't run scripts anymore (such as tinc-down or host-up), unless it is setup to be runnable inside chroot environment.
106− '';
107− };
108− };
109111 };
110112 };
111113
nixos/modules/services/networking/xinetd.nix+64−62
@@ -65,71 +65,73 @@ in
6565 A list of services provided by xinetd.
6666 '';
6767
68− type = types.listOf types.optionSet;
68+ type = with types; listOf (submodule ({
69+
70+ options = {
71+
72+ name = mkOption {
73+ type = types.string;
74+ example = "login";
75+ description = "Name of the service.";
76+ };
77+
78+ protocol = mkOption {
79+ type = types.string;
80+ default = "tcp";
81+ description =
82+ "Protocol of the service. Usually <literal>tcp</literal> or <literal>udp</literal>.";
83+ };
84+
85+ port = mkOption {
86+ type = types.int;
87+ default = 0;
88+ example = 123;
89+ description = "Port number of the service.";
90+ };
91+
92+ user = mkOption {
93+ type = types.string;
94+ default = "nobody";
95+ description = "User account for the service";
96+ };
97+
98+ server = mkOption {
99+ type = types.string;
100+ example = "/foo/bin/ftpd";
101+ description = "Path of the program that implements the service.";
102+ };
103+
104+ serverArgs = mkOption {
105+ type = types.string;
106+ default = "";
107+ description = "Command-line arguments for the server program.";
108+ };
109+
110+ flags = mkOption {
111+ type = types.string;
112+ default = "";
113+ description = "";
114+ };
115+
116+ unlisted = mkOption {
117+ type = types.bool;
118+ default = false;
119+ description = ''
120+ Whether this server is listed in
121+ <filename>/etc/services</filename>. If so, the port
122+ number can be omitted.
123+ '';
124+ };
125+
126+ extraConfig = mkOption {
127+ type = types.string;
128+ default = "";
129+ description = "Extra configuration-lines added to the section of the service.";
130+ };
69131
70− options = {
71−
72− name = mkOption {
73− type = types.string;
74− example = "login";
75− description = "Name of the service.";
76− };
77−
78− protocol = mkOption {
79− type = types.string;
80− default = "tcp";
81− description =
82− "Protocol of the service. Usually <literal>tcp</literal> or <literal>udp</literal>.";
83− };
84−
85− port = mkOption {
86− type = types.int;
87− default = 0;
88− example = 123;
89− description = "Port number of the service.";
90− };
91−
92− user = mkOption {
93− type = types.string;
94− default = "nobody";
95− description = "User account for the service";
96− };
97−
98− server = mkOption {
99− type = types.string;
100− example = "/foo/bin/ftpd";
101− description = "Path of the program that implements the service.";
102− };
103−
104− serverArgs = mkOption {
105− type = types.string;
106− default = "";
107− description = "Command-line arguments for the server program.";
108− };
109−
110− flags = mkOption {
111− type = types.string;
112− default = "";
113− description = "";
114− };
115−
116− unlisted = mkOption {
117− type = types.bool;
118− default = false;
119− description = ''
120− Whether this server is listed in
121− <filename>/etc/services</filename>. If so, the port
122− number can be omitted.
123− '';
124− };
125−
126− extraConfig = mkOption {
127− type = types.string;
128− default = "";
129− description = "Extra configuration-lines added to the section of the service.";
130132 };
131133
132− };
134+ }));
133135
134136 };
135137
nixos/modules/services/web-servers/winstone.nix+1−2
@@ -113,8 +113,7 @@ in {
113113 options = {
114114 services.winstone = mkOption {
115115 default = {};
116− type = types.attrsOf types.optionSet;
117− options = [ winstoneOpts ];
116+ type = with types; attrsOf (submodule winstoneOpts);
118117 description = ''
119118 Defines independent Winstone services, each serving one WAR-file.
120119 '';
nixos/modules/services/web-servers/zope2.nix+1−2
@@ -74,7 +74,7 @@ in
7474
7575 services.zope2.instances = mkOption {
7676 default = {};
77− type = types.loaOf types.optionSet;
77+ type = with types; loaOf (submodule zope2Opts);
7878 example = literalExample ''
7979 {
8080 plone01 = {
@@ -96,7 +96,6 @@ in
9696 }
9797 '';
9898 description = "zope2 instances to be created automaticaly by the system.";
99− options = [ zope2Opts ];
10099 };
101100 };
102101
nixos/modules/system/boot/loader/grub/grub.nix+43−43
@@ -131,51 +131,51 @@ in
131131 to the respective devices corresponding to those partitions.
132132 '';
133133
134− type = types.listOf types.optionSet;
134+ type = with types; listOf (submodule {
135+ options = {
136+
137+ path = mkOption {
138+ example = "/boot1";
139+ type = types.str;
140+ description = ''
141+ The path to the boot directory where GRUB will be written. Generally
142+ this boot path should double as an EFI path.
143+ '';
144+ };
145+
146+ efiSysMountPoint = mkOption {
147+ default = null;
148+ example = "/boot1/efi";
149+ type = types.nullOr types.str;
150+ description = ''
151+ The path to the efi system mount point. Usually this is the same
152+ partition as the above path and can be left as null.
153+ '';
154+ };
155+
156+ efiBootloaderId = mkOption {
157+ default = null;
158+ example = "NixOS-fsid";
159+ type = types.nullOr types.str;
160+ description = ''
161+ The id of the bootloader to store in efi nvram.
162+ The default is to name it NixOS and append the path or efiSysMountPoint.
163+ This is only used if <literal>boot.loader.efi.canTouchEfiVariables</literal> is true.
164+ '';
165+ };
166+
167+ devices = mkOption {
168+ default = [ ];
169+ example = [ "/dev/sda" "/dev/sdb" ];
170+ type = types.listOf types.str;
171+ description = ''
172+ The path to the devices which will have the GRUB MBR written.
173+ Note these are typically device paths and not paths to partitions.
174+ '';
175+ };
135176
136− options = {
137−
138− path = mkOption {
139− example = "/boot1";
140− type = types.str;
141− description = ''
142− The path to the boot directory where GRUB will be written. Generally
143− this boot path should double as an EFI path.
144− '';
145− };
146−
147− efiSysMountPoint = mkOption {
148− default = null;
149− example = "/boot1/efi";
150− type = types.nullOr types.str;
151− description = ''
152− The path to the efi system mount point. Usually this is the same
153− partition as the above path and can be left as null.
154− '';
155− };
156−
157− efiBootloaderId = mkOption {
158− default = null;
159− example = "NixOS-fsid";
160− type = types.nullOr types.str;
161− description = ''
162− The id of the bootloader to store in efi nvram.
163− The default is to name it NixOS and append the path or efiSysMountPoint.
164− This is only used if <literal>boot.loader.efi.canTouchEfiVariables</literal> is true.
165− '';
166177 };
167−
168− devices = mkOption {
169− default = [ ];
170− example = [ "/dev/sda" "/dev/sdb" ];
171− type = types.listOf types.str;
172− description = ''
173− The path to the devices which will have the GRUB MBR written.
174− Note these are typically device paths and not paths to partitions.
175− '';
176− };
177−
178− };
178+ });
179179 };
180180
181181 configurationName = mkOption {
nixos/modules/system/boot/luksroot.nix+152−152
@@ -236,165 +236,165 @@ in
236236 <filename>/dev/mapper/<replaceable>name</replaceable></filename>.
237237 '';
238238
239− type = types.loaOf types.optionSet;
240−
241− options = { name, ... }: { options = {
242−
243− name = mkOption {
244− visible = false;
245− default = name;
246− example = "luksroot";
247− type = types.str;
248− description = "Name of the unencrypted device in <filename>/dev/mapper</filename>.";
249− };
250−
251− device = mkOption {
252− example = "/dev/disk/by-uuid/430e9eff-d852-4f68-aa3b-2fa3599ebe08";
253− type = types.str;
254− description = "Path of the underlying encrypted block device.";
255− };
256−
257− header = mkOption {
258− default = null;
259− example = "/root/header.img";
260− type = types.nullOr types.str;
261− description = ''
262− The name of the file or block device that
263− should be used as header for the encrypted device.
264− '';
265− };
266−
267− keyFile = mkOption {
268− default = null;
269− example = "/dev/sdb1";
270− type = types.nullOr types.str;
271− description = ''
272− The name of the file (can be a raw device or a partition) that
273− should be used as the decryption key for the encrypted device. If
274− not specified, you will be prompted for a passphrase instead.
275− '';
276− };
277−
278− keyFileSize = mkOption {
279− default = null;
280− example = 4096;
281− type = types.nullOr types.int;
282− description = ''
283− The size of the key file. Use this if only the beginning of the
284− key file should be used as a key (often the case if a raw device
285− or partition is used as key file). If not specified, the whole
286− <literal>keyFile</literal> will be used decryption, instead of just
287− the first <literal>keyFileSize</literal> bytes.
288− '';
289− };
290−
291− # FIXME: get rid of this option.
292− preLVM = mkOption {
293− default = true;
294− type = types.bool;
295− description = "Whether the luksOpen will be attempted before LVM scan or after it.";
296− };
297−
298− allowDiscards = mkOption {
299− default = false;
300− type = types.bool;
301− description = ''
302− Whether to allow TRIM requests to the underlying device. This option
303− has security implications; please read the LUKS documentation before
304− activating it.
305− '';
306− };
307−
308− yubikey = mkOption {
309− default = null;
310− type = types.nullOr types.optionSet;
311− description = ''
312− The options to use for this LUKS device in Yubikey-PBA.
313− If null (the default), Yubikey-PBA will be disabled for this device.
314− '';
239+ type = with types; loaOf (submodule (
240+ { name, ... }: { options = {
241+
242+ name = mkOption {
243+ visible = false;
244+ default = name;
245+ example = "luksroot";
246+ type = types.str;
247+ description = "Name of the unencrypted device in <filename>/dev/mapper</filename>.";
248+ };
315249
316− options = {
317− twoFactor = mkOption {
318− default = true;
319− type = types.bool;
320− description = "Whether to use a passphrase and a Yubikey (true), or only a Yubikey (false).";
321− };
322−
323− slot = mkOption {
324− default = 2;
325− type = types.int;
326− description = "Which slot on the Yubikey to challenge.";
327− };
328−
329− saltLength = mkOption {
330− default = 16;
331− type = types.int;
332− description = "Length of the new salt in byte (64 is the effective maximum).";
333− };
334−
335− keyLength = mkOption {
336− default = 64;
337− type = types.int;
338− description = "Length of the LUKS slot key derived with PBKDF2 in byte.";
339− };
340−
341− iterationStep = mkOption {
342− default = 0;
343− type = types.int;
344− description = "How much the iteration count for PBKDF2 is increased at each successful authentication.";
345− };
346−
347− gracePeriod = mkOption {
348− default = 2;
349− type = types.int;
350− description = "Time in seconds to wait before attempting to find the Yubikey.";
351− };
352−
353− ramfsMountPoint = mkOption {
354− default = "/crypt-ramfs";
355− type = types.str;
356− description = "Path where the ramfs used to update the LUKS key will be mounted during early boot.";
357− };
358−
359− /* TODO: Add to the documentation of the current module:
360−
361− Options related to the storing the salt.
362− */
363− storage = {
364− device = mkOption {
365− default = "/dev/sda1";
366− type = types.path;
367− description = ''
368− An unencrypted device that will temporarily be mounted in stage-1.
369− Must contain the current salt to create the challenge for this LUKS device.
370− '';
371− };
250+ device = mkOption {
251+ example = "/dev/disk/by-uuid/430e9eff-d852-4f68-aa3b-2fa3599ebe08";
252+ type = types.str;
253+ description = "Path of the underlying encrypted block device.";
254+ };
372255
373− fsType = mkOption {
374− default = "vfat";
375− type = types.str;
376− description = "The filesystem of the unencrypted device.";
377− };
256+ header = mkOption {
257+ default = null;
258+ example = "/root/header.img";
259+ type = types.nullOr types.str;
260+ description = ''
261+ The name of the file or block device that
262+ should be used as header for the encrypted device.
263+ '';
264+ };
378265
379− mountPoint = mkOption {
380− default = "/crypt-storage";
381− type = types.str;
382− description = "Path where the unencrypted device will be mounted during early boot.";
383− };
266+ keyFile = mkOption {
267+ default = null;
268+ example = "/dev/sdb1";
269+ type = types.nullOr types.str;
270+ description = ''
271+ The name of the file (can be a raw device or a partition) that
272+ should be used as the decryption key for the encrypted device. If
273+ not specified, you will be prompted for a passphrase instead.
274+ '';
275+ };
276+
277+ keyFileSize = mkOption {
278+ default = null;
279+ example = 4096;
280+ type = types.nullOr types.int;
281+ description = ''
282+ The size of the key file. Use this if only the beginning of the
283+ key file should be used as a key (often the case if a raw device
284+ or partition is used as key file). If not specified, the whole
285+ <literal>keyFile</literal> will be used decryption, instead of just
286+ the first <literal>keyFileSize</literal> bytes.
287+ '';
288+ };
289+
290+ # FIXME: get rid of this option.
291+ preLVM = mkOption {
292+ default = true;
293+ type = types.bool;
294+ description = "Whether the luksOpen will be attempted before LVM scan or after it.";
295+ };
296+
297+ allowDiscards = mkOption {
298+ default = false;
299+ type = types.bool;
300+ description = ''
301+ Whether to allow TRIM requests to the underlying device. This option
302+ has security implications; please read the LUKS documentation before
303+ activating it.
304+ '';
305+ };
384306
385− path = mkOption {
386− default = "/crypt-storage/default";
387− type = types.str;
388− description = ''
389− Absolute path of the salt on the unencrypted device with
390− that device's root directory as "/".
391− '';
307+ yubikey = mkOption {
308+ default = null;
309+ description = ''
310+ The options to use for this LUKS device in Yubikey-PBA.
311+ If null (the default), Yubikey-PBA will be disabled for this device.
312+ '';
313+
314+ type = with types; nullOr (submodule {
315+ options = {
316+ twoFactor = mkOption {
317+ default = true;
318+ type = types.bool;
319+ description = "Whether to use a passphrase and a Yubikey (true), or only a Yubikey (false).";
320+ };
321+
322+ slot = mkOption {
323+ default = 2;
324+ type = types.int;
325+ description = "Which slot on the Yubikey to challenge.";
326+ };
327+
328+ saltLength = mkOption {
329+ default = 16;
330+ type = types.int;
331+ description = "Length of the new salt in byte (64 is the effective maximum).";
332+ };
333+
334+ keyLength = mkOption {
335+ default = 64;
336+ type = types.int;
337+ description = "Length of the LUKS slot key derived with PBKDF2 in byte.";
338+ };
339+
340+ iterationStep = mkOption {
341+ default = 0;
342+ type = types.int;
343+ description = "How much the iteration count for PBKDF2 is increased at each successful authentication.";
344+ };
345+
346+ gracePeriod = mkOption {
347+ default = 2;
348+ type = types.int;
349+ description = "Time in seconds to wait before attempting to find the Yubikey.";
350+ };
351+
352+ ramfsMountPoint = mkOption {
353+ default = "/crypt-ramfs";
354+ type = types.str;
355+ description = "Path where the ramfs used to update the LUKS key will be mounted during early boot.";
356+ };
357+
358+ /* TODO: Add to the documentation of the current module:
359+
360+ Options related to the storing the salt.
361+ */
362+ storage = {
363+ device = mkOption {
364+ default = "/dev/sda1";
365+ type = types.path;
366+ description = ''
367+ An unencrypted device that will temporarily be mounted in stage-1.
368+ Must contain the current salt to create the challenge for this LUKS device.
369+ '';
370+ };
371+
372+ fsType = mkOption {
373+ default = "vfat";
374+ type = types.str;
375+ description = "The filesystem of the unencrypted device.";
376+ };
377+
378+ mountPoint = mkOption {
379+ default = "/crypt-storage";
380+ type = types.str;
381+ description = "Path where the unencrypted device will be mounted during early boot.";
382+ };
383+
384+ path = mkOption {
385+ default = "/crypt-storage/default";
386+ type = types.str;
387+ description = ''
388+ Absolute path of the salt on the unencrypted device with
389+ that device's root directory as "/".
390+ '';
391+ };
392+ };
392393 };
393− };
394+ });
394395 };
395− };
396396
397− }; };
397+ }; }));
398398 };
399399
400400 boot.initrd.luks.yubikeySupport = mkOption {
nixos/modules/system/boot/networkd.nix+8−13
@@ -471,8 +471,7 @@ let
471471
472472 addresses = mkOption {
473473 default = [ ];
474− type = types.listOf types.optionSet;
475− options = [ addressOptions ];
474+ type = with types; listOf (submodule [ addressOptions ]);
476475 description = ''
477476 A list of address sections to be added to the unit. See
478477 <citerefentry><refentrytitle>systemd.network</refentrytitle>
@@ -482,8 +481,7 @@ let
482481
483482 routes = mkOption {
484483 default = [ ];
485− type = types.listOf types.optionSet;
486− options = [ routeOptions ];
484+ type = with types; listOf (submodule [ routeOptions ]);
487485 description = ''
488486 A list of route sections to be added to the unit. See
489487 <citerefentry><refentrytitle>systemd.network</refentrytitle>
@@ -624,35 +622,32 @@ in
624622
625623 systemd.network.links = mkOption {
626624 default = {};
627− type = types.attrsOf types.optionSet;
628− options = [ linkOptions ];
625+ type = with types; attrsOf (submodule [ linkOptions ]);
629626 description = "Definition of systemd network links.";
630627 };
631628
632629 systemd.network.netdevs = mkOption {
633630 default = {};
634− type = types.attrsOf types.optionSet;
635− options = [ netdevOptions ];
631+ type = with types; attrsOf (submodule [ netdevOptions ]);
636632 description = "Definition of systemd network devices.";
637633 };
638634
639635 systemd.network.networks = mkOption {
640636 default = {};
641− type = types.attrsOf types.optionSet;
642− options = [ networkOptions networkConfig ];
637+ type = with types; attrsOf (submodule [ networkOptions networkConfig ]);
643638 description = "Definition of systemd networks.";
644639 };
645640
646641 systemd.network.units = mkOption {
647642 description = "Definition of networkd units.";
648643 default = {};
649− type = types.attrsOf types.optionSet;
650− options = { name, config, ... }:
644+ type = with types; attrsOf (submodule (
645+ { name, config, ... }:
651646 { options = concreteUnitOptions;
652647 config = {
653648 unit = mkDefault (makeUnit name config);
654649 };
655− };
650+ }));
656651 };
657652
658653 };
nixos/modules/system/boot/systemd.nix+16−26
@@ -389,13 +389,13 @@ in
389389 systemd.units = mkOption {
390390 description = "Definition of systemd units.";
391391 default = {};
392− type = types.attrsOf types.optionSet;
393− options = { name, config, ... }:
392+ type = with types; attrsOf (submodule (
393+ { name, config, ... }:
394394 { options = concreteUnitOptions;
395395 config = {
396396 unit = mkDefault (makeUnit name config);
397397 };
398− };
398+ }));
399399 };
400400
401401 systemd.packages = mkOption {
@@ -406,43 +406,37 @@ in
406406
407407 systemd.targets = mkOption {
408408 default = {};
409− type = types.attrsOf types.optionSet;
410− options = [ targetOptions unitConfig ];
409+ type = with types; attrsOf (submodule [ { options = targetOptions; } unitConfig] );
411410 description = "Definition of systemd target units.";
412411 };
413412
414413 systemd.services = mkOption {
415414 default = {};
416− type = types.attrsOf types.optionSet;
417− options = [ serviceOptions unitConfig serviceConfig ];
415+ type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ]);
418416 description = "Definition of systemd service units.";
419417 };
420418
421419 systemd.sockets = mkOption {
422420 default = {};
423− type = types.attrsOf types.optionSet;
424− options = [ socketOptions unitConfig ];
421+ type = with types; attrsOf (submodule [ { options = socketOptions; } unitConfig ]);
425422 description = "Definition of systemd socket units.";
426423 };
427424
428425 systemd.timers = mkOption {
429426 default = {};
430− type = types.attrsOf types.optionSet;
431− options = [ timerOptions unitConfig ];
427+ type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ]);
432428 description = "Definition of systemd timer units.";
433429 };
434430
435431 systemd.paths = mkOption {
436432 default = {};
437− type = types.attrsOf types.optionSet;
438− options = [ pathOptions unitConfig ];
433+ type = with types; attrsOf (submodule [ { options = pathOptions; } unitConfig ]);
439434 description = "Definition of systemd path units.";
440435 };
441436
442437 systemd.mounts = mkOption {
443438 default = [];
444− type = types.listOf types.optionSet;
445− options = [ mountOptions unitConfig mountConfig ];
439+ type = with types; listOf (submodule [ { options = mountOptions; } unitConfig mountConfig ]);
446440 description = ''
447441 Definition of systemd mount units.
448442 This is a list instead of an attrSet, because systemd mandates the names to be derived from
@@ -452,8 +446,7 @@ in
452446
453447 systemd.automounts = mkOption {
454448 default = [];
455− type = types.listOf types.optionSet;
456− options = [ automountOptions unitConfig automountConfig ];
449+ type = with types; listOf (submodule [ { options = automountOptions; } unitConfig automountConfig ]);
457450 description = ''
458451 Definition of systemd automount units.
459452 This is a list instead of an attrSet, because systemd mandates the names to be derived from
@@ -600,33 +593,30 @@ in
600593 systemd.user.units = mkOption {
601594 description = "Definition of systemd per-user units.";
602595 default = {};
603− type = types.attrsOf types.optionSet;
604− options = { name, config, ... }:
596+ type = with types; attrsOf (submodule (
597+ { name, config, ... }:
605598 { options = concreteUnitOptions;
606599 config = {
607600 unit = mkDefault (makeUnit name config);
608601 };
609− };
602+ }));
610603 };
611604
612605 systemd.user.services = mkOption {
613606 default = {};
614− type = types.attrsOf types.optionSet;
615− options = [ serviceOptions unitConfig serviceConfig ];
607+ type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ] );
616608 description = "Definition of systemd per-user service units.";
617609 };
618610
619611 systemd.user.timers = mkOption {
620612 default = {};
621− type = types.attrsOf types.optionSet;
622− options = [ timerOptions unitConfig ];
613+ type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ] );
623614 description = "Definition of systemd per-user timer units.";
624615 };
625616
626617 systemd.user.sockets = mkOption {
627618 default = {};
628− type = types.attrsOf types.optionSet;
629− options = [ socketOptions unitConfig ];
619+ type = with types; attrsOf (submodule [ { options = socketOptions; } unitConfig ] );
630620 description = "Definition of systemd per-user socket units.";
631621 };
632622
nixos/modules/system/etc/etc.nix+3−3
@@ -33,7 +33,6 @@ in
3333 options = {
3434
3535 environment.etc = mkOption {
36− type = types.loaOf types.optionSet;
3736 default = {};
3837 example = literalExample ''
3938 { example-configuration-file =
@@ -47,7 +46,8 @@ in
4746 Set of files that have to be linked in <filename>/etc</filename>.
4847 '';
4948
50− options = singleton ({ name, config, ... }:
49+ type = with types; loaOf (submodule (
50+ { name, config, ... }:
5151 { options = {
5252
5353 enable = mkOption {
@@ -117,7 +117,7 @@ in
117117 in mkDefault (pkgs.writeText name' config.text));
118118 };
119119
120− });
120+ }));
121121
122122 };
123123
nixos/modules/tasks/network-interfaces.nix+261−247
@@ -97,21 +97,22 @@ let
9797
9898 addrOpts = v:
9999 assert v == 4 || v == 6;
100− {
101− address = mkOption {
102− type = types.str;
103− description = ''
104− IPv${toString v} address of the interface. Leave empty to configure the
105− interface using DHCP.
106− '';
107− };
100+ { options = {
101+ address = mkOption {
102+ type = types.str;
103+ description = ''
104+ IPv${toString v} address of the interface. Leave empty to configure the
105+ interface using DHCP.
106+ '';
107+ };
108108
109− prefixLength = mkOption {
110− type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
111− description = ''
112− Subnet mask of the interface, specified as the number of
113− bits in the prefix (<literal>${if v == 4 then "24" else "64"}</literal>).
114− '';
109+ prefixLength = mkOption {
110+ type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
111+ description = ''
112+ Subnet mask of the interface, specified as the number of
113+ bits in the prefix (<literal>${if v == 4 then "24" else "64"}</literal>).
114+ '';
115+ };
115116 };
116117 };
117118
@@ -141,8 +142,7 @@ let
141142 { address = "10.0.0.1"; prefixLength = 16; }
142143 { address = "192.168.1.1"; prefixLength = 24; }
143144 ];
144− type = types.listOf types.optionSet;
145− options = addrOpts 4;
145+ type = with types; listOf (submodule (addrOpts 4));
146146 description = ''
147147 List of IPv4 addresses that will be statically assigned to the interface.
148148 '';
@@ -154,8 +154,7 @@ let
154154 { address = "fdfd:b3f0:482::1"; prefixLength = 48; }
155155 { address = "2001:1470:fffd:2098::e006"; prefixLength = 64; }
156156 ];
157− type = types.listOf types.optionSet;
158− options = addrOpts 6;
157+ type = with types; listOf (submodule (addrOpts 6));
159158 description = ''
160159 List of IPv6 addresses that will be statically assigned to the interface.
161160 '';
@@ -415,8 +414,7 @@ in
415414 <option>networking.useDHCP</option> is true, then every
416415 interface not listed here will be configured using DHCP.
417416 '';
418− type = types.loaOf types.optionSet;
419− options = [ interfaceOpts ];
417+ type = with types; loaOf (submodule interfaceOpts);
420418 };
421419
422420 networking.vswitches = mkOption {
@@ -434,53 +432,55 @@ in
434432 interface.
435433 '';
436434
437− type = types.attrsOf types.optionSet;
435+ type = with types; attrsOf (submodule {
438436
439− options = {
437+ options = {
440438
441− interfaces = mkOption {
442− example = [ "eth0" "eth1" ];
443− type = types.listOf types.str;
444− description =
445− "The physical network interfaces connected by the vSwitch.";
446− };
439+ interfaces = mkOption {
440+ example = [ "eth0" "eth1" ];
441+ type = types.listOf types.str;
442+ description =
443+ "The physical network interfaces connected by the vSwitch.";
444+ };
447445
448− controllers = mkOption {
449− type = types.listOf types.str;
450− default = [];
451− example = [ "ptcp:6653:[::1]" ];
452− description = ''
453− Specify the controller targets. For the allowed options see <literal>man 8 ovs-vsctl</literal>.
454− '';
455− };
446+ controllers = mkOption {
447+ type = types.listOf types.str;
448+ default = [];
449+ example = [ "ptcp:6653:[::1]" ];
450+ description = ''
451+ Specify the controller targets. For the allowed options see <literal>man 8 ovs-vsctl</literal>.
452+ '';
453+ };
456454
457− openFlowRules = mkOption {
458− type = types.lines;
459− default = "";
460− example = ''
461− actions=normal
462− '';
463− description = ''
464− OpenFlow rules to insert into the Open vSwitch. All <literal>openFlowRules</literal> are
465− loaded with <literal>ovs-ofctl</literal> within one atomic operation.
466− '';
467− };
455+ openFlowRules = mkOption {
456+ type = types.lines;
457+ default = "";
458+ example = ''
459+ actions=normal
460+ '';
461+ description = ''
462+ OpenFlow rules to insert into the Open vSwitch. All <literal>openFlowRules</literal> are
463+ loaded with <literal>ovs-ofctl</literal> within one atomic operation.
464+ '';
465+ };
466+
467+ extraOvsctlCmds = mkOption {
468+ type = types.lines;
469+ default = "";
470+ example = ''
471+ set-fail-mode <switch_name> secure
472+ set Bridge <switch_name> stp_enable=true
473+ '';
474+ description = ''
475+ Commands to manipulate the Open vSwitch database. Every line executed with <literal>ovs-vsctl</literal>.
476+ All commands are bundled together with the operations for adding the interfaces
477+ into one atomic operation.
478+ '';
479+ };
468480
469− extraOvsctlCmds = mkOption {
470− type = types.lines;
471− default = "";
472− example = ''
473− set-fail-mode <switch_name> secure
474− set Bridge <switch_name> stp_enable=true
475− '';
476− description = ''
477− Commands to manipulate the Open vSwitch database. Every line executed with <literal>ovs-vsctl</literal>.
478− All commands are bundled together with the operations for adding the interfaces
479− into one atomic operation.
480− '';
481481 };
482482
483− };
483+ });
484484
485485 };
486486
@@ -499,25 +499,27 @@ in
499499 bridge's network interface.
500500 '';
501501
502− type = types.attrsOf types.optionSet;
502+ type = with types; attrsOf (submodule {
503503
504− options = {
504+ options = {
505505
506− interfaces = mkOption {
507− example = [ "eth0" "eth1" ];
508− type = types.listOf types.str;
509− description =
510− "The physical network interfaces connected by the bridge.";
511− };
506+ interfaces = mkOption {
507+ example = [ "eth0" "eth1" ];
508+ type = types.listOf types.str;
509+ description =
510+ "The physical network interfaces connected by the bridge.";
511+ };
512+
513+ rstp = mkOption {
514+ example = true;
515+ default = false;
516+ type = types.bool;
517+ description = "Whether the bridge interface should enable rstp.";
518+ };
512519
513− rstp = mkOption {
514− example = true;
515− default = false;
516− type = types.bool;
517− description = "Whether the bridge interface should enable rstp.";
518520 };
519521
520− };
522+ });
521523
522524 };
523525
@@ -538,65 +540,66 @@ in
538540 name specifying the name of the bond's network interface
539541 '';
540542
541− type = types.attrsOf types.optionSet;
543+ type = with types; attrsOf (submodule {
542544
543− options = {
545+ options = {
544546
545− interfaces = mkOption {
546− example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
547− type = types.listOf types.str;
548− description = "The interfaces to bond together";
549− };
547+ interfaces = mkOption {
548+ example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
549+ type = types.listOf types.str;
550+ description = "The interfaces to bond together";
551+ };
550552
551− lacp_rate = mkOption {
552− default = null;
553− example = "fast";
554− type = types.nullOr types.str;
555− description = ''
556− Option specifying the rate in which we'll ask our link partner
557− to transmit LACPDU packets in 802.3ad mode.
558− '';
559− };
560−
561− miimon = mkOption {
562− default = null;
563− example = 100;
564− type = types.nullOr types.int;
565− description = ''
566− Miimon is the number of millisecond in between each round of polling
567− by the device driver for failed links. By default polling is not
568− enabled and the driver is trusted to properly detect and handle
569− failure scenarios.
570− '';
571− };
572−
573− mode = mkOption {
574− default = null;
575− example = "active-backup";
576− type = types.nullOr types.str;
577− description = ''
578− The mode which the bond will be running. The default mode for
579− the bonding driver is balance-rr, optimizing for throughput.
580− More information about valid modes can be found at
581− https://www.kernel.org/doc/Documentation/networking/bonding.txt
582− '';
583− };
553+ lacp_rate = mkOption {
554+ default = null;
555+ example = "fast";
556+ type = types.nullOr types.str;
557+ description = ''
558+ Option specifying the rate in which we'll ask our link partner
559+ to transmit LACPDU packets in 802.3ad mode.
560+ '';
561+ };
562+
563+ miimon = mkOption {
564+ default = null;
565+ example = 100;
566+ type = types.nullOr types.int;
567+ description = ''
568+ Miimon is the number of millisecond in between each round of polling
569+ by the device driver for failed links. By default polling is not
570+ enabled and the driver is trusted to properly detect and handle
571+ failure scenarios.
572+ '';
573+ };
574+
575+ mode = mkOption {
576+ default = null;
577+ example = "active-backup";
578+ type = types.nullOr types.str;
579+ description = ''
580+ The mode which the bond will be running. The default mode for
581+ the bonding driver is balance-rr, optimizing for throughput.
582+ More information about valid modes can be found at
583+ https://www.kernel.org/doc/Documentation/networking/bonding.txt
584+ '';
585+ };
586+
587+ xmit_hash_policy = mkOption {
588+ default = null;
589+ example = "layer2+3";
590+ type = types.nullOr types.str;
591+ description = ''
592+ Selects the transmit hash policy to use for slave selection in
593+ balance-xor, 802.3ad, and tlb modes.
594+ '';
595+ };
584596
585− xmit_hash_policy = mkOption {
586− default = null;
587− example = "layer2+3";
588− type = types.nullOr types.str;
589− description = ''
590− Selects the transmit hash policy to use for slave selection in
591− balance-xor, 802.3ad, and tlb modes.
592− '';
593597 };
594598
595− };
599+ });
596600 };
597601
598602 networking.macvlans = mkOption {
599− type = types.attrsOf types.optionSet;
600603 default = { };
601604 example = literalExample {
602605 wan = {
@@ -608,26 +611,28 @@ in
608611 This option allows you to define macvlan interfaces which should
609612 be automatically created.
610613 '';
611− options = {
614+ type = with types; attrsOf (submodule {
615+ options = {
616+
617+ interface = mkOption {
618+ example = "enp4s0";
619+ type = types.str;
620+ description = "The interface the macvlan will transmit packets through.";
621+ };
622+
623+ mode = mkOption {
624+ default = null;
625+ type = types.nullOr types.str;
626+ example = "vepa";
627+ description = "The mode of the macvlan device.";
628+ };
612629
613− interface = mkOption {
614− example = "enp4s0";
615− type = types.str;
616− description = "The interface the macvlan will transmit packets through.";
617630 };
618631
619− mode = mkOption {
620− default = null;
621− type = types.nullOr types.str;
622− example = "vepa";
623− description = "The mode of the macvlan device.";
624− };
625−
626− };
632+ });
627633 };
628634
629635 networking.sits = mkOption {
630− type = types.attrsOf types.optionSet;
631636 default = { };
632637 example = literalExample {
633638 hurricane = {
@@ -644,46 +649,49 @@ in
644649 description = ''
645650 This option allows you to define 6-to-4 interfaces which should be automatically created.
646651 '';
647− options = {
648−
649− remote = mkOption {
650− type = types.nullOr types.str;
651− default = null;
652− example = "10.0.0.1";
653− description = ''
654− The address of the remote endpoint to forward traffic over.
655− '';
656− };
657−
658− local = mkOption {
659− type = types.nullOr types.str;
660− default = null;
661− example = "10.0.0.22";
662− description = ''
663− The address of the local endpoint which the remote
664− side should send packets to.
665− '';
666− };
667−
668− ttl = mkOption {
669− type = types.nullOr types.int;
670− default = null;
671− example = 255;
672− description = ''
673− The time-to-live of the connection to the remote tunnel endpoint.
674− '';
675− };
652+ type = with types; attrsOf (submodule {
653+ options = {
654+
655+ remote = mkOption {
656+ type = types.nullOr types.str;
657+ default = null;
658+ example = "10.0.0.1";
659+ description = ''
660+ The address of the remote endpoint to forward traffic over.
661+ '';
662+ };
663+
664+ local = mkOption {
665+ type = types.nullOr types.str;
666+ default = null;
667+ example = "10.0.0.22";
668+ description = ''
669+ The address of the local endpoint which the remote
670+ side should send packets to.
671+ '';
672+ };
673+
674+ ttl = mkOption {
675+ type = types.nullOr types.int;
676+ default = null;
677+ example = 255;
678+ description = ''
679+ The time-to-live of the connection to the remote tunnel endpoint.
680+ '';
681+ };
682+
683+ dev = mkOption {
684+ type = types.nullOr types.str;
685+ default = null;
686+ example = "enp4s0f0";
687+ description = ''
688+ The underlying network device on which the tunnel resides.
689+ '';
690+ };
676691
677− dev = mkOption {
678− type = types.nullOr types.str;
679− default = null;
680− example = "enp4s0f0";
681− description = ''
682− The underlying network device on which the tunnel resides.
683− '';
684692 };
685693
686− };
694+ });
687695 };
688696
689697 networking.vlans = mkOption {
@@ -706,23 +714,26 @@ in
706714 specifying the name of the vlan interface.
707715 '';
708716
709− type = types.attrsOf types.optionSet;
717+ type = with types; attrsOf (submodule {
710718
711− options = {
719+ options = {
712720
713− id = mkOption {
714− example = 1;
715− type = types.int;
716− description = "The vlan identifier";
717− };
721+ id = mkOption {
722+ example = 1;
723+ type = types.int;
724+ description = "The vlan identifier";
725+ };
726+
727+ interface = mkOption {
728+ example = "enp4s0";
729+ type = types.str;
730+ description = "The interface the vlan will transmit packets through.";
731+ };
718732
719− interface = mkOption {
720− example = "enp4s0";
721− type = types.str;
722− description = "The interface the vlan will transmit packets through.";
723733 };
724734
725− };
735+ });
736+
726737 };
727738
728739 networking.wlanInterfaces = mkOption {
@@ -760,73 +771,76 @@ in
760771 would have to be created explicitly.
761772 '';
762773
763− type = types.attrsOf types.optionSet;
764−
765− options = {
774+ type = with types; attrsOf (submodule {
766775
767− device = mkOption {
768− type = types.string;
769− example = "wlp6s0";
770− description = "The name of the underlying hardware WLAN device as assigned by <literal>udev</literal>.";
771− };
776+ options = {
772777
773− type = mkOption {
774− type = types.string;
775− default = "managed";
776− example = "ibss";
777− description = ''
778− The type of the WLAN interface. The type has to be either <literal>managed</literal>,
779− <literal>ibss</literal>, <literal>monitor</literal>, <literal>mesh</literal> or <literal>wds</literal>.
780− Also, the type has to be supported by the underlying hardware of the device.
781− '';
782− };
778+ device = mkOption {
779+ type = types.string;
780+ example = "wlp6s0";
781+ description = "The name of the underlying hardware WLAN device as assigned by <literal>udev</literal>.";
782+ };
783783
784− meshID = mkOption {
785− type = types.nullOr types.string;
786− default = null;
787− description = "MeshID of interface with type <literal>mesh</literal>.";
788− };
789−
790− flags = mkOption {
791− type = types.nullOr types.string;
792− default = null;
793− example = "control";
794− description = ''
795− Flags for interface of type <literal>monitor</literal>. The valid flags are:
796− none: no special flags
797− fcsfail: show frames with FCS errors
798− control: show control frames
799− otherbss: show frames from other BSSes
800− cook: use cooked mode
801− active: use active mode (ACK incoming unicast packets)
802− '';
803− };
784+ type = mkOption {
785+ type = types.string;
786+ default = "managed";
787+ example = "ibss";
788+ description = ''
789+ The type of the WLAN interface. The type has to be either <literal>managed</literal>,
790+ <literal>ibss</literal>, <literal>monitor</literal>, <literal>mesh</literal> or <literal>wds</literal>.
791+ Also, the type has to be supported by the underlying hardware of the device.
792+ '';
793+ };
794+
795+ meshID = mkOption {
796+ type = types.nullOr types.string;
797+ default = null;
798+ description = "MeshID of interface with type <literal>mesh</literal>.";
799+ };
800+
801+ flags = mkOption {
802+ type = types.nullOr types.string;
803+ default = null;
804+ example = "control";
805+ description = ''
806+ Flags for interface of type <literal>monitor</literal>. The valid flags are:
807+ none: no special flags
808+ fcsfail: show frames with FCS errors
809+ control: show control frames
810+ otherbss: show frames from other BSSes
811+ cook: use cooked mode
812+ active: use active mode (ACK incoming unicast packets)
813+ '';
814+ };
815+
816+ fourAddr = mkOption {
817+ type = types.nullOr types.bool;
818+ default = null;
819+ description = "Whether to enable <literal>4-address mode</literal> with type <literal>managed</literal>.";
820+ };
821+
822+ mac = mkOption {
823+ type = types.nullOr types.str;
824+ default = null;
825+ example = "02:00:00:00:00:01";
826+ description = ''
827+ MAC address to use for the device. If <literal>null</literal>, then the MAC of the
828+ underlying hardware WLAN device is used.
829+
830+ INFO: Locally administered MAC addresses are of the form:
831+ <itemizedlist>
832+ <listitem><para>x2:xx:xx:xx:xx:xx</para></listitem>
833+ <listitem><para>x6:xx:xx:xx:xx:xx</para></listitem>
834+ <listitem><para>xA:xx:xx:xx:xx:xx</para></listitem>
835+ <listitem><para>xE:xx:xx:xx:xx:xx</para></listitem>
836+ </itemizedlist>
837+ '';
838+ };
804839
805− fourAddr = mkOption {
806− type = types.nullOr types.bool;
807− default = null;
808− description = "Whether to enable <literal>4-address mode</literal> with type <literal>managed</literal>.";
809840 };
810841
811− mac = mkOption {
812− type = types.nullOr types.str;
813− default = null;
814− example = "02:00:00:00:00:01";
815− description = ''
816− MAC address to use for the device. If <literal>null</literal>, then the MAC of the
817− underlying hardware WLAN device is used.
818−
819− INFO: Locally administered MAC addresses are of the form:
820− <itemizedlist>
821− <listitem><para>x2:xx:xx:xx:xx:xx</para></listitem>
822− <listitem><para>x6:xx:xx:xx:xx:xx</para></listitem>
823− <listitem><para>xA:xx:xx:xx:xx:xx</para></listitem>
824− <listitem><para>xE:xx:xx:xx:xx:xx</para></listitem>
825− </itemizedlist>
826− '';
827− };
842+ });
828843
829− };
830844 };
831845
832846 networking.useDHCP = mkOption {
nixos/modules/virtualisation/containers.nix+2−4
@@ -473,9 +473,8 @@ in
473473 };
474474
475475 extraVeths = mkOption {
476− type = types.attrsOf types.optionSet;
476+ type = with types; attrsOf (submodule networkOptions);
477477 default = {};
478− options = networkOptions;
479478 description = ''
480479 Extra veth-pairs to be created for the container
481480 '';
@@ -490,8 +489,7 @@ in
490489 };
491490
492491 bindMounts = mkOption {
493− type = types.loaOf types.optionSet;
494− options = [ bindMountOpts ];
492+ type = with types; loaOf (submodule bindMountOpts);
495493 default = {};
496494 example = { "/home" = { hostPath = "/home/alice";
497495 isReadOnly = false; };