Merge pull request #18511 from ericsagnes/feat/remove-optionSet

modules: optionSet -> submodule
This commit is contained in:
Joachim F 2016-10-01 17:57:45 +02:00 committed by GitHub
commit 7e80c42b0e
28 changed files with 1101 additions and 1108 deletions

View File

@ -261,7 +261,7 @@ rec {
# declarations from the options attribute of containing option # declarations from the options attribute of containing option
# declaration. # declaration.
optionSet = mkOptionType { optionSet = mkOptionType {
name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set"; name = builtins.trace "types.optionSet is deprecated; use types.submodule instead" "option set";
}; };
# Augment the given type with an additional type check function. # Augment the given type with an additional type check function.

View File

@ -131,13 +131,12 @@ let
}; };
subUidRanges = mkOption { subUidRanges = mkOption {
type = types.listOf types.optionSet; type = with types; listOf (submodule subordinateUidRange);
default = []; default = [];
example = [ example = [
{ startUid = 1000; count = 1; } { startUid = 1000; count = 1; }
{ startUid = 100001; count = 65534; } { startUid = 100001; count = 65534; }
]; ];
options = [ subordinateUidRange ];
description = '' description = ''
Subordinate user ids that user is allowed to use. Subordinate user ids that user is allowed to use.
They are set into <filename>/etc/subuid</filename> and are used They are set into <filename>/etc/subuid</filename> and are used
@ -146,13 +145,12 @@ let
}; };
subGidRanges = mkOption { subGidRanges = mkOption {
type = types.listOf types.optionSet; type = with types; listOf (submodule subordinateGidRange);
default = []; default = [];
example = [ example = [
{ startGid = 100; count = 1; } { startGid = 100; count = 1; }
{ startGid = 1001; count = 999; } { startGid = 1001; count = 999; }
]; ];
options = [ subordinateGidRange ];
description = '' description = ''
Subordinate group ids that user is allowed to use. Subordinate group ids that user is allowed to use.
They are set into <filename>/etc/subgid</filename> and are used They are set into <filename>/etc/subgid</filename> and are used
@ -310,6 +308,7 @@ let
}; };
subordinateUidRange = { subordinateUidRange = {
options = {
startUid = mkOption { startUid = mkOption {
type = types.int; type = types.int;
description = '' description = ''
@ -323,8 +322,10 @@ let
description = ''Count of subordinate user ids''; description = ''Count of subordinate user ids'';
}; };
}; };
};
subordinateGidRange = { subordinateGidRange = {
options = {
startGid = mkOption { startGid = mkOption {
type = types.int; type = types.int;
description = '' description = ''
@ -338,6 +339,7 @@ let
description = ''Count of subordinate group ids''; description = ''Count of subordinate group ids'';
}; };
}; };
};
mkSubuidEntry = user: concatStrings ( mkSubuidEntry = user: concatStrings (
map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n") map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n")
@ -428,7 +430,7 @@ in {
users.users = mkOption { users.users = mkOption {
default = {}; default = {};
type = types.loaOf types.optionSet; type = with types; loaOf (submodule userOpts);
example = { example = {
alice = { alice = {
uid = 1234; uid = 1234;
@ -444,7 +446,6 @@ in {
Additional user accounts to be created automatically by the system. Additional user accounts to be created automatically by the system.
This can also be used to set options for root. This can also be used to set options for root.
''; '';
options = [ userOpts ];
}; };
users.groups = mkOption { users.groups = mkOption {
@ -453,11 +454,10 @@ in {
{ students.gid = 1001; { students.gid = 1001;
hackers = { }; hackers = { };
}; };
type = types.loaOf types.optionSet; type = with types; loaOf (submodule groupOpts);
description = '' description = ''
Additional groups to be created automatically by the system. Additional groups to be created automatically by the system.
''; '';
options = [ groupOpts ];
}; };
# FIXME: obsolete - will remove. # FIXME: obsolete - will remove.

View File

@ -129,11 +129,10 @@ in
certs = mkOption { certs = mkOption {
default = { }; default = { };
type = types.loaOf types.optionSet; type = with types; loaOf (submodule certOpts);
description = '' description = ''
Attribute set of certificates to get signed and renewed. Attribute set of certificates to get signed and renewed.
''; '';
options = [ certOpts ];
example = { example = {
"example.com" = { "example.com" = {
webroot = "/var/www/challenges/"; webroot = "/var/www/challenges/";

View File

@ -386,8 +386,7 @@ in
security.pam.services = mkOption { security.pam.services = mkOption {
default = []; default = [];
type = types.loaOf types.optionSet; type = with types; loaOf (submodule pamOpts);
options = [ pamOpts ];
description = description =
'' ''
This option defines the PAM services. A service typically This option defines the PAM services. A service typically

View File

@ -198,8 +198,7 @@ in {
description = '' description = ''
This option defines director resources in Bacula File Daemon. This option defines director resources in Bacula File Daemon.
''; '';
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule directorOptions);
options = [ directorOptions ];
}; };
extraClientConfig = mkOption { extraClientConfig = mkOption {
@ -253,8 +252,7 @@ in {
description = '' description = ''
This option defines Director resources in Bacula Storage Daemon. This option defines Director resources in Bacula Storage Daemon.
''; '';
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule directorOptions);
options = [ directorOptions ];
}; };
device = mkOption { device = mkOption {
@ -262,8 +260,7 @@ in {
description = '' description = ''
This option defines Device resources in Bacula Storage Daemon. This option defines Device resources in Bacula Storage Daemon.
''; '';
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule deviceOptions);
options = [ deviceOptions ];
}; };
extraStorageConfig = mkOption { extraStorageConfig = mkOption {

View File

@ -81,12 +81,11 @@ in
{ office1 = { model = "MFC-7860DW"; ip = "192.168.1.2"; }; { office1 = { model = "MFC-7860DW"; ip = "192.168.1.2"; };
office2 = { model = "MFC-7860DW"; nodename = "BRW0080927AFBCE"; }; office2 = { model = "MFC-7860DW"; nodename = "BRW0080927AFBCE"; };
}; };
type = types.loaOf types.optionSet; type = with types; loaOf (submodule netDeviceOpts);
description = '' description = ''
The list of network devices that will be registered against the brscan4 The list of network devices that will be registered against the brscan4
sane backend. sane backend.
''; '';
options = [ netDeviceOpts ];
}; };
}; };

View File

@ -62,6 +62,7 @@ let
}; };
ignoreOptions = { ignoreOptions = {
options = {
level = levelOption; level = levelOption;
regex = mkOption { regex = mkOption {
@ -72,8 +73,10 @@ let
''; '';
}; };
}; };
};
ignoreCronOptions = { ignoreCronOptions = {
options = {
user = mkOption { user = mkOption {
default = "root"; default = "root";
type = types.str; type = types.str;
@ -100,6 +103,7 @@ let
''; '';
}; };
}; };
};
in in
{ {
@ -180,8 +184,7 @@ in
description = '' description = ''
This option defines extra ignore rules. This option defines extra ignore rules.
''; '';
type = types.loaOf types.optionSet; type = with types; loaOf (submodule ignoreOptions);
options = [ ignoreOptions ];
}; };
ignoreCron = mkOption { ignoreCron = mkOption {
@ -189,8 +192,7 @@ in
description = '' description = ''
This option defines extra ignore rules for cronjobs. This option defines extra ignore rules for cronjobs.
''; '';
type = types.loaOf types.optionSet; type = with types; loaOf (submodule ignoreCronOptions);
options = [ ignoreOptions ignoreCronOptions ];
}; };
extraGroups = mkOption { extraGroups = mkOption {

View File

@ -154,6 +154,7 @@ let
}; };
dbOptions = { dbOptions = {
options = {
type = mkOption { type = mkOption {
description = "Rippled database type."; description = "Rippled database type.";
type = types.enum ["rocksdb" "nudb"]; type = types.enum ["rocksdb" "nudb"];
@ -193,6 +194,7 @@ let
default = ""; default = "";
}; };
}; };
};
in in
@ -213,8 +215,7 @@ in
ports = mkOption { ports = mkOption {
description = "Ports exposed by rippled"; description = "Ports exposed by rippled";
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule portOptions);
options = [portOptions];
default = { default = {
rpc = { rpc = {
port = 5005; port = 5005;
@ -238,8 +239,7 @@ in
nodeDb = mkOption { nodeDb = mkOption {
description = "Rippled main database options."; description = "Rippled main database options.";
type = types.nullOr types.optionSet; type = with types; nullOr (submodule dbOptions);
options = dbOptions;
default = { default = {
type = "rocksdb"; type = "rocksdb";
extraOpts = '' extraOpts = ''
@ -254,15 +254,13 @@ in
tempDb = mkOption { tempDb = mkOption {
description = "Rippled temporary database options."; description = "Rippled temporary database options.";
type = types.nullOr types.optionSet; type = with types; nullOr (submodule dbOptions);
options = dbOptions;
default = null; default = null;
}; };
importDb = mkOption { importDb = mkOption {
description = "Settings for performing a one-time import."; description = "Settings for performing a one-time import.";
type = types.nullOr types.optionSet; type = with types; nullOr (submodule dbOptions);
options = dbOptions;
default = null; default = null;
}; };

View File

@ -197,8 +197,7 @@ in
devices = mkOption { devices = mkOption {
default = []; default = [];
example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ]; example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
type = types.listOf types.optionSet; type = with types; listOf (submodule smartdOpts);
options = [ smartdOpts ];
description = "List of devices to monitor."; description = "List of devices to monitor.";
}; };

View File

@ -169,8 +169,7 @@ in
monitoring directly. These are usually attached to serial ports, monitoring directly. These are usually attached to serial ports,
but USB devices are also supported. but USB devices are also supported.
''; '';
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule upsOptions);
options = [ upsOptions ];
}; };
}; };

View File

@ -8,10 +8,7 @@ in
options.services.tahoe = { options.services.tahoe = {
introducers = mkOption { introducers = mkOption {
default = {}; default = {};
type = types.loaOf types.optionSet; type = with types; loaOf (submodule {
description = ''
The Tahoe introducers.
'';
options = { options = {
nickname = mkOption { nickname = mkOption {
type = types.str; type = types.str;
@ -45,13 +42,14 @@ in
''; '';
}; };
}; };
});
description = ''
The Tahoe introducers.
'';
}; };
nodes = mkOption { nodes = mkOption {
default = {}; default = {};
type = types.loaOf types.optionSet; type = with types; loaOf (submodule {
description = ''
The Tahoe nodes.
'';
options = { options = {
nickname = mkOption { nickname = mkOption {
type = types.str; type = types.str;
@ -150,6 +148,10 @@ in
''; '';
}; };
}; };
});
description = ''
The Tahoe nodes.
'';
}; };
}; };
config = mkMerge [ config = mkMerge [

View File

@ -187,26 +187,23 @@ in
outTunnels = mkOption { outTunnels = mkOption {
default = {}; default = {};
type = with types; loaOf optionSet; type = with types; loaOf (submodule (
description = '' { name, config, ... }: {
Connect to someone as a client and establish a local accept endpoint
'';
options = [ ({ name, config, ... }: {
options = commonTunOpts name; options = commonTunOpts name;
config = { config = {
name = mkDefault name; name = mkDefault name;
}; };
}) ]; }
));
description = ''
Connect to someone as a client and establish a local accept endpoint
'';
}; };
inTunnels = mkOption { inTunnels = mkOption {
default = {}; default = {};
type = with types; loaOf optionSet; type = with types; loaOf (submodule (
description = '' { name, config, ... }: {
Serve something on I2P network at port and delegate requests to address inPort.
'';
options = [ ({ name, config, ... }: {
options = { options = {
inPort = mkOption { inPort = mkOption {
type = types.int; type = types.int;
@ -219,12 +216,14 @@ in
description = "I2P nodes that are allowed to connect to this service."; description = "I2P nodes that are allowed to connect to this service.";
}; };
} // commonTunOpts name; } // commonTunOpts name;
config = { config = {
name = mkDefault name; name = mkDefault name;
}; };
}
}) ]; ));
description = ''
Serve something on I2P network at port and delegate requests to address inPort.
'';
}; };
}; };
}; };

View File

@ -122,9 +122,7 @@ in
}; };
networking.nat.forwardPorts = mkOption { networking.nat.forwardPorts = mkOption {
type = types.listOf types.optionSet; type = with types; listOf (submodule {
default = [];
example = [ { sourcePort = 8080; destination = "10.0.0.1:80"; } ];
options = { options = {
sourcePort = mkOption { sourcePort = mkOption {
type = types.int; type = types.int;
@ -138,7 +136,9 @@ in
description = "Forward tcp connection to destination ip:port"; description = "Forward tcp connection to destination ip:port";
}; };
}; };
});
default = [];
example = [ { sourcePort = 8080; destination = "10.0.0.1:80"; } ];
description = description =
'' ''
List of forwarded ports from the external interface to List of forwarded ports from the external interface to

View File

@ -116,7 +116,7 @@ in
attribute name. attribute name.
''; '';
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule {
options = { options = {
@ -163,6 +163,8 @@ in
}; };
});
}; };
}; };

View File

@ -164,7 +164,7 @@ in
description = "Define the virtual hosts"; description = "Define the virtual hosts";
type = types.loaOf types.optionSet; type = with types; loaOf (submodule vHostOpts);
example = { example = {
myhost = { myhost = {
@ -180,7 +180,6 @@ in
}; };
}; };
options = [ vHostOpts ];
}; };
ssl = mkOption { ssl = mkOption {

View File

@ -129,17 +129,7 @@ in
}; };
listenAddresses = mkOption { listenAddresses = mkOption {
type = types.listOf types.optionSet; type = with types; listOf (submodule {
default = [];
example = [ { addr = "192.168.3.1"; port = 22; } { addr = "0.0.0.0"; port = 64022; } ];
description = ''
List of addresses and ports to listen on (ListenAddress directive
in config). If port is not specified for address sshd will listen
on all ports specified by <literal>ports</literal> option.
NOTE: this will override default listening on all local addresses and port 22.
NOTE: setting this option won't automatically enable given ports
in firewall configuration.
'';
options = { options = {
addr = mkOption { addr = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
@ -156,6 +146,17 @@ in
''; '';
}; };
}; };
});
default = [];
example = [ { addr = "192.168.3.1"; port = 22; } { addr = "0.0.0.0"; port = 64022; } ];
description = ''
List of addresses and ports to listen on (ListenAddress directive
in config). If port is not specified for address sshd will listen
on all ports specified by <literal>ports</literal> option.
NOTE: this will override default listening on all local addresses and port 22.
NOTE: setting this option won't automatically enable given ports
in firewall configuration.
'';
}; };
passwordAuthentication = mkOption { passwordAuthentication = mkOption {

View File

@ -75,40 +75,7 @@ in
options = { options = {
networking.supplicant = mkOption { networking.supplicant = mkOption {
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule {
default = { };
example = {
"wlan0 wlan1" = {
configFile = "/etc/wpa_supplicant";
userControlled.group = "network";
extraConf = ''
ap_scan=1
p2p_disabled=1
'';
extraCmdArgs = "-u -W";
bridge = "br0";
};
};
description = ''
Interfaces for which to start <command>wpa_supplicant</command>.
The supplicant is used to scan for and associate with wireless networks,
or to authenticate with 802.1x capable network switches.
The value of this option is an attribute set. Each attribute configures a
<command>wpa_supplicant</command> service, where the attribute name specifies
the name of the interface that <command>wpa_supplicant</command> operates on.
The attribute name can be a space separated list of interfaces.
The attribute names <literal>WLAN</literal>, <literal>LAN</literal> and <literal>DBUS</literal>
have a special meaning. <literal>WLAN</literal> and <literal>LAN</literal> are
configurations for universal <command>wpa_supplicant</command> service that is
started for each WLAN interface or for each LAN interface, respectively.
<literal>DBUS</literal> defines a device-unrelated <command>wpa_supplicant</command>
service that can be accessed through <literal>D-Bus</literal>.
'';
options = { options = {
configFile = { configFile = {
@ -207,8 +174,40 @@ in
}; };
}; };
}; };
});
default = { };
example = {
"wlan0 wlan1" = {
configFile = "/etc/wpa_supplicant";
userControlled.group = "network";
extraConf = ''
ap_scan=1
p2p_disabled=1
'';
extraCmdArgs = "-u -W";
bridge = "br0";
};
};
description = ''
Interfaces for which to start <command>wpa_supplicant</command>.
The supplicant is used to scan for and associate with wireless networks,
or to authenticate with 802.1x capable network switches.
The value of this option is an attribute set. Each attribute configures a
<command>wpa_supplicant</command> service, where the attribute name specifies
the name of the interface that <command>wpa_supplicant</command> operates on.
The attribute name can be a space separated list of interfaces.
The attribute names <literal>WLAN</literal>, <literal>LAN</literal> and <literal>DBUS</literal>
have a special meaning. <literal>WLAN</literal> and <literal>LAN</literal> are
configurations for universal <command>wpa_supplicant</command> service that is
started for each WLAN interface or for each LAN interface, respectively.
<literal>DBUS</literal> defines a device-unrelated <command>wpa_supplicant</command>
service that can be accessed through <literal>D-Bus</literal>.
'';
}; };

View File

@ -18,11 +18,7 @@ in
networks = mkOption { networks = mkOption {
default = { }; default = { };
type = types.loaOf types.optionSet; type = with types; loaOf (submodule {
description = ''
Defines the tinc networks which will be started.
Each network invokes a different daemon.
'';
options = { options = {
extraConfig = mkOption { extraConfig = mkOption {
@ -106,6 +102,12 @@ in
''; '';
}; };
}; };
});
description = ''
Defines the tinc networks which will be started.
Each network invokes a different daemon.
'';
}; };
}; };

View File

@ -65,7 +65,7 @@ in
A list of services provided by xinetd. A list of services provided by xinetd.
''; '';
type = types.listOf types.optionSet; type = with types; listOf (submodule ({
options = { options = {
@ -131,6 +131,8 @@ in
}; };
}));
}; };
}; };

View File

@ -113,8 +113,7 @@ in {
options = { options = {
services.winstone = mkOption { services.winstone = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule winstoneOpts);
options = [ winstoneOpts ];
description = '' description = ''
Defines independent Winstone services, each serving one WAR-file. Defines independent Winstone services, each serving one WAR-file.
''; '';

View File

@ -74,7 +74,7 @@ in
services.zope2.instances = mkOption { services.zope2.instances = mkOption {
default = {}; default = {};
type = types.loaOf types.optionSet; type = with types; loaOf (submodule zope2Opts);
example = literalExample '' example = literalExample ''
{ {
plone01 = { plone01 = {
@ -96,7 +96,6 @@ in
} }
''; '';
description = "zope2 instances to be created automaticaly by the system."; description = "zope2 instances to be created automaticaly by the system.";
options = [ zope2Opts ];
}; };
}; };

View File

@ -131,8 +131,7 @@ in
to the respective devices corresponding to those partitions. to the respective devices corresponding to those partitions.
''; '';
type = types.listOf types.optionSet; type = with types; listOf (submodule {
options = { options = {
path = mkOption { path = mkOption {
@ -176,6 +175,7 @@ in
}; };
}; };
});
}; };
configurationName = mkOption { configurationName = mkOption {

View File

@ -236,9 +236,8 @@ in
<filename>/dev/mapper/<replaceable>name</replaceable></filename>. <filename>/dev/mapper/<replaceable>name</replaceable></filename>.
''; '';
type = types.loaOf types.optionSet; type = with types; loaOf (submodule (
{ name, ... }: { options = {
options = { name, ... }: { options = {
name = mkOption { name = mkOption {
visible = false; visible = false;
@ -307,12 +306,12 @@ in
yubikey = mkOption { yubikey = mkOption {
default = null; default = null;
type = types.nullOr types.optionSet;
description = '' description = ''
The options to use for this LUKS device in Yubikey-PBA. The options to use for this LUKS device in Yubikey-PBA.
If null (the default), Yubikey-PBA will be disabled for this device. If null (the default), Yubikey-PBA will be disabled for this device.
''; '';
type = with types; nullOr (submodule {
options = { options = {
twoFactor = mkOption { twoFactor = mkOption {
default = true; default = true;
@ -392,9 +391,10 @@ in
}; };
}; };
}; };
});
}; };
}; }; }; }));
}; };
boot.initrd.luks.yubikeySupport = mkOption { boot.initrd.luks.yubikeySupport = mkOption {

View File

@ -471,8 +471,7 @@ let
addresses = mkOption { addresses = mkOption {
default = [ ]; default = [ ];
type = types.listOf types.optionSet; type = with types; listOf (submodule [ addressOptions ]);
options = [ addressOptions ];
description = '' description = ''
A list of address sections to be added to the unit. See A list of address sections to be added to the unit. See
<citerefentry><refentrytitle>systemd.network</refentrytitle> <citerefentry><refentrytitle>systemd.network</refentrytitle>
@ -482,8 +481,7 @@ let
routes = mkOption { routes = mkOption {
default = [ ]; default = [ ];
type = types.listOf types.optionSet; type = with types; listOf (submodule [ routeOptions ]);
options = [ routeOptions ];
description = '' description = ''
A list of route sections to be added to the unit. See A list of route sections to be added to the unit. See
<citerefentry><refentrytitle>systemd.network</refentrytitle> <citerefentry><refentrytitle>systemd.network</refentrytitle>
@ -624,35 +622,32 @@ in
systemd.network.links = mkOption { systemd.network.links = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ linkOptions ]);
options = [ linkOptions ];
description = "Definition of systemd network links."; description = "Definition of systemd network links.";
}; };
systemd.network.netdevs = mkOption { systemd.network.netdevs = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ netdevOptions ]);
options = [ netdevOptions ];
description = "Definition of systemd network devices."; description = "Definition of systemd network devices.";
}; };
systemd.network.networks = mkOption { systemd.network.networks = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ networkOptions networkConfig ]);
options = [ networkOptions networkConfig ];
description = "Definition of systemd networks."; description = "Definition of systemd networks.";
}; };
systemd.network.units = mkOption { systemd.network.units = mkOption {
description = "Definition of networkd units."; description = "Definition of networkd units.";
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule (
options = { name, config, ... }: { name, config, ... }:
{ options = concreteUnitOptions; { options = concreteUnitOptions;
config = { config = {
unit = mkDefault (makeUnit name config); unit = mkDefault (makeUnit name config);
}; };
}; }));
}; };
}; };

View File

@ -389,13 +389,13 @@ in
systemd.units = mkOption { systemd.units = mkOption {
description = "Definition of systemd units."; description = "Definition of systemd units.";
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule (
options = { name, config, ... }: { name, config, ... }:
{ options = concreteUnitOptions; { options = concreteUnitOptions;
config = { config = {
unit = mkDefault (makeUnit name config); unit = mkDefault (makeUnit name config);
}; };
}; }));
}; };
systemd.packages = mkOption { systemd.packages = mkOption {
@ -406,43 +406,37 @@ in
systemd.targets = mkOption { systemd.targets = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = targetOptions; } unitConfig] );
options = [ targetOptions unitConfig ];
description = "Definition of systemd target units."; description = "Definition of systemd target units.";
}; };
systemd.services = mkOption { systemd.services = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ]);
options = [ serviceOptions unitConfig serviceConfig ];
description = "Definition of systemd service units."; description = "Definition of systemd service units.";
}; };
systemd.sockets = mkOption { systemd.sockets = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = socketOptions; } unitConfig ]);
options = [ socketOptions unitConfig ];
description = "Definition of systemd socket units."; description = "Definition of systemd socket units.";
}; };
systemd.timers = mkOption { systemd.timers = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ]);
options = [ timerOptions unitConfig ];
description = "Definition of systemd timer units."; description = "Definition of systemd timer units.";
}; };
systemd.paths = mkOption { systemd.paths = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = pathOptions; } unitConfig ]);
options = [ pathOptions unitConfig ];
description = "Definition of systemd path units."; description = "Definition of systemd path units.";
}; };
systemd.mounts = mkOption { systemd.mounts = mkOption {
default = []; default = [];
type = types.listOf types.optionSet; type = with types; listOf (submodule [ { options = mountOptions; } unitConfig mountConfig ]);
options = [ mountOptions unitConfig mountConfig ];
description = '' description = ''
Definition of systemd mount units. Definition of systemd mount units.
This is a list instead of an attrSet, because systemd mandates the names to be derived from This is a list instead of an attrSet, because systemd mandates the names to be derived from
@ -452,8 +446,7 @@ in
systemd.automounts = mkOption { systemd.automounts = mkOption {
default = []; default = [];
type = types.listOf types.optionSet; type = with types; listOf (submodule [ { options = automountOptions; } unitConfig automountConfig ]);
options = [ automountOptions unitConfig automountConfig ];
description = '' description = ''
Definition of systemd automount units. Definition of systemd automount units.
This is a list instead of an attrSet, because systemd mandates the names to be derived from This is a list instead of an attrSet, because systemd mandates the names to be derived from
@ -600,33 +593,30 @@ in
systemd.user.units = mkOption { systemd.user.units = mkOption {
description = "Definition of systemd per-user units."; description = "Definition of systemd per-user units.";
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule (
options = { name, config, ... }: { name, config, ... }:
{ options = concreteUnitOptions; { options = concreteUnitOptions;
config = { config = {
unit = mkDefault (makeUnit name config); unit = mkDefault (makeUnit name config);
}; };
}; }));
}; };
systemd.user.services = mkOption { systemd.user.services = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ] );
options = [ serviceOptions unitConfig serviceConfig ];
description = "Definition of systemd per-user service units."; description = "Definition of systemd per-user service units.";
}; };
systemd.user.timers = mkOption { systemd.user.timers = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ] );
options = [ timerOptions unitConfig ];
description = "Definition of systemd per-user timer units."; description = "Definition of systemd per-user timer units.";
}; };
systemd.user.sockets = mkOption { systemd.user.sockets = mkOption {
default = {}; default = {};
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule [ { options = socketOptions; } unitConfig ] );
options = [ socketOptions unitConfig ];
description = "Definition of systemd per-user socket units."; description = "Definition of systemd per-user socket units.";
}; };

View File

@ -33,7 +33,6 @@ in
options = { options = {
environment.etc = mkOption { environment.etc = mkOption {
type = types.loaOf types.optionSet;
default = {}; default = {};
example = literalExample '' example = literalExample ''
{ example-configuration-file = { example-configuration-file =
@ -47,7 +46,8 @@ in
Set of files that have to be linked in <filename>/etc</filename>. Set of files that have to be linked in <filename>/etc</filename>.
''; '';
options = singleton ({ name, config, ... }: type = with types; loaOf (submodule (
{ name, config, ... }:
{ options = { { options = {
enable = mkOption { enable = mkOption {
@ -117,7 +117,7 @@ in
in mkDefault (pkgs.writeText name' config.text)); in mkDefault (pkgs.writeText name' config.text));
}; };
}); }));
}; };

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 {

View File

@ -473,9 +473,8 @@ in
}; };
extraVeths = mkOption { extraVeths = mkOption {
type = types.attrsOf types.optionSet; type = with types; attrsOf (submodule networkOptions);
default = {}; default = {};
options = networkOptions;
description = '' description = ''
Extra veth-pairs to be created for the container Extra veth-pairs to be created for the container
''; '';
@ -490,8 +489,7 @@ in
}; };
bindMounts = mkOption { bindMounts = mkOption {
type = types.loaOf types.optionSet; type = with types; loaOf (submodule bindMountOpts);
options = [ bindMountOpts ];
default = {}; default = {};
example = { "/home" = { hostPath = "/home/alice"; example = { "/home" = { hostPath = "/home/alice";
isReadOnly = false; }; isReadOnly = false; };