Merge pull request #96042 from rnhmjoj/loaOf

treewide: completely remove types.loaOf
This commit is contained in:
WORLDofPEACE 2020-09-02 08:45:37 -04:00 committed by GitHub
commit 18348c7829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 79 additions and 176 deletions

View File

@ -613,7 +613,6 @@ rec {
if tp.name == "option set" || tp.name == "submodule" then if tp.name == "option set" || tp.name == "submodule" then
throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}." throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}."
else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options) else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options)
else if optionSetIn "loaOf" then types.loaOf (types.submodule options)
else if optionSetIn "listOf" then types.listOf (types.submodule options) else if optionSetIn "listOf" then types.listOf (types.submodule options)
else if optionSetIn "nullOr" then types.nullOr (types.submodule options) else if optionSetIn "nullOr" then types.nullOr (types.submodule options)
else tp; else tp;

View File

@ -252,8 +252,8 @@ rec {
merge = mergeEqualOption; merge = mergeEqualOption;
}; };
# drop this in the future: # TODO: drop this in the future:
list = builtins.trace "`types.list` is deprecated; use `types.listOf` instead" types.listOf; list = builtins.trace "`types.list` has been removed; please use `types.listOf` instead" types.listOf;
listOf = elemType: mkOptionType rec { listOf = elemType: mkOptionType rec {
name = "listOf"; name = "listOf";
@ -326,110 +326,15 @@ rec {
functor = (defaultFunctor name) // { wrapped = elemType; }; functor = (defaultFunctor name) // { wrapped = elemType; };
}; };
# List or attribute set of ... # TODO: drop this in the future:
loaOf = elemType: loaOf =
let let msg =
convertAllLists = loc: defs: ''
let `types.loaOf` has been removed and mixing lists with attribute values
padWidth = stringLength (toString (length defs)); is no longer possible; please use `types.attrsOf` instead.
unnamedPrefix = i: "unnamed-" + fixedWidthNumber padWidth i + "."; See https://github.com/NixOS/nixpkgs/issues/1800 for the motivation.
in '';
imap1 (i: convertIfList loc (unnamedPrefix i)) defs; in builtins.trace msg types.attrsOf;
convertIfList = loc: unnamedPrefix: def:
if isList def.value then
let
padWidth = stringLength (toString (length def.value));
unnamed = i: unnamedPrefix + fixedWidthNumber padWidth i;
anyString = placeholder "name";
nameAttrs = [
{ path = [ "environment" "etc" ];
name = "target";
}
{ path = [ "containers" anyString "bindMounts" ];
name = "mountPoint";
}
{ path = [ "programs" "ssh" "knownHosts" ];
# hostNames is actually a list so we would need to handle it only when singleton
name = "hostNames";
}
{ path = [ "fileSystems" ];
name = "mountPoint";
}
{ path = [ "boot" "specialFileSystems" ];
name = "mountPoint";
}
{ path = [ "services" "znapzend" "zetup" ];
name = "dataset";
}
{ path = [ "services" "znapzend" "zetup" anyString "destinations" ];
name = "label";
}
{ path = [ "services" "geoclue2" "appConfig" ];
name = "desktopID";
}
];
matched = let
equals = a: b: b == anyString || a == b;
fallback = { name = "name"; };
in findFirst ({ path, ... }: all (v: v == true) (zipListsWith equals loc path)) fallback nameAttrs;
nameAttr = matched.name;
nameValueOld = value:
if isList value then
if length value > 0 then
"[ " + concatMapStringsSep " " escapeNixString value + " ]"
else
"[ ]"
else
escapeNixString value;
nameValueNew = value: unnamed:
if isList value then
if length value > 0 then
head value
else
unnamed
else
value;
res =
{ inherit (def) file;
value = listToAttrs (
imap1 (elemIdx: elem:
{ name = nameValueNew (elem.${nameAttr} or (unnamed elemIdx)) (unnamed elemIdx);
value = elem;
}) def.value);
};
option = concatStringsSep "." loc;
sample = take 3 def.value;
more = lib.optionalString (length def.value > 3) "... ";
list = concatMapStrings (x: ''{ ${nameAttr} = ${nameValueOld (x.${nameAttr} or "unnamed")}; ...} '') sample;
set = concatMapStrings (x: ''${nameValueNew (x.${nameAttr} or "unnamed") "unnamed"} = {...}; '') sample;
msg = ''
In file ${def.file}
a list is being assigned to the option config.${option}.
This will soon be an error as type loaOf is deprecated.
See https://github.com/NixOS/nixpkgs/pull/63103 for more information.
Do
${option} =
{ ${set}${more}}
instead of
${option} =
[ ${list}${more}]
'';
in
lib.warn msg res
else
def;
attrOnly = attrsOf elemType;
in mkOptionType rec {
name = "loaOf";
description = "list or attribute set of ${elemType.description}s";
check = x: isList x || isAttrs x;
merge = loc: defs: attrOnly.merge loc (convertAllLists loc defs);
emptyValue = { value = {}; };
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name?>"]);
getSubModules = elemType.getSubModules;
substSubModules = m: loaOf (elemType.substSubModules m);
functor = (defaultFunctor name) // { wrapped = elemType; };
};
# Value of given type but with no merging (i.e. `uniq list`s are not concatenated). # Value of given type but with no merging (i.e. `uniq list`s are not concatenated).
uniq = elemType: mkOptionType rec { uniq = elemType: mkOptionType rec {

View File

@ -58,9 +58,9 @@
Like <literal>boot.debug1</literal> or Like <literal>boot.debug1</literal> or
<literal>boot.debug1devices</literal>, but runs stage1 until all <literal>boot.debug1devices</literal>, but runs stage1 until all
filesystems that are mounted during initrd are mounted (see filesystems that are mounted during initrd are mounted (see
<option><link linkend="opt-fileSystems._name__.neededForBoot">neededForBoot</link></option> <option><link linkend="opt-fileSystems._name_.neededForBoot">neededForBoot</link></option>
). As a motivating example, this could be useful if you've forgotten to set ). As a motivating example, this could be useful if you've forgotten to set
<option><link linkend="opt-fileSystems._name__.neededForBoot">neededForBoot</link></option> <option><link linkend="opt-fileSystems._name_.neededForBoot">neededForBoot</link></option>
on a file system. on a file system.
</para> </para>
</listitem> </listitem>

View File

@ -27,7 +27,7 @@
<screen> <screen>
# nixos-container create foo --config ' # nixos-container create foo --config '
<xref linkend="opt-services.openssh.enable"/> = true; <xref linkend="opt-services.openssh.enable"/> = true;
<link linkend="opt-users.users._name__.openssh.authorizedKeys.keys">users.users.root.openssh.authorizedKeys.keys</link> = ["ssh-dss AAAAB3N…"]; <link linkend="opt-users.users._name_.openssh.authorizedKeys.keys">users.users.root.openssh.authorizedKeys.keys</link> = ["ssh-dss AAAAB3N…"];
' '
</screen> </screen>
By default the next free address in the <literal>10.233.0.0/16</literal> subnet will be chosen By default the next free address in the <literal>10.233.0.0/16</literal> subnet will be chosen

View File

@ -23,12 +23,12 @@
<link xlink:href="https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html">systemd-fstab-generator</link>. <link xlink:href="https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html">systemd-fstab-generator</link>.
The filesystem will be mounted automatically unless The filesystem will be mounted automatically unless
<literal>"noauto"</literal> is present in <link <literal>"noauto"</literal> is present in <link
linkend="opt-fileSystems._name__.options">options</link>. linkend="opt-fileSystems._name_.options">options</link>.
<literal>"noauto"</literal> filesystems can be mounted explicitly using <literal>"noauto"</literal> filesystems can be mounted explicitly using
<command>systemctl</command> e.g. <command>systemctl start <command>systemctl</command> e.g. <command>systemctl start
data.mount</command>. data.mount</command>.
Mount points are created automatically if they dont already exist. For Mount points are created automatically if they dont already exist. For
<option><link linkend="opt-fileSystems._name__.device">device</link></option>, <option><link linkend="opt-fileSystems._name_.device">device</link></option>,
its best to use the topology-independent device aliases in its best to use the topology-independent device aliases in
<filename>/dev/disk/by-label</filename> and <filename>/dev/disk/by-label</filename> and
<filename>/dev/disk/by-uuid</filename>, as these dont change if the <filename>/dev/disk/by-uuid</filename>, as these dont change if the
@ -36,7 +36,7 @@
</para> </para>
<para> <para>
You can usually omit the file system type You can usually omit the file system type
(<option><link linkend="opt-fileSystems._name__.fsType">fsType</link></option>), (<option><link linkend="opt-fileSystems._name_.fsType">fsType</link></option>),
since <command>mount</command> can usually detect the type and load the since <command>mount</command> can usually detect the type and load the
necessary kernel module automatically. However, if the file system is needed necessary kernel module automatically. However, if the file system is needed
at early boot (in the initial ramdisk) and is not <literal>ext2</literal>, at early boot (in the initial ramdisk) and is not <literal>ext2</literal>,
@ -49,7 +49,7 @@
System startup will fail if any of the filesystems fails to mount, dropping System startup will fail if any of the filesystems fails to mount, dropping
you to the emergency shell. You can make a mount asynchronous and you to the emergency shell. You can make a mount asynchronous and
non-critical by adding non-critical by adding
<literal><link linkend="opt-fileSystems._name__.options">options</link> = [ <literal><link linkend="opt-fileSystems._name_.options">options</link> = [
"nofail" ];</literal>. "nofail" ];</literal>.
</para> </para>
</note> </note>

View File

@ -10,7 +10,7 @@
automatically configure network interfaces. However, you can configure an automatically configure network interfaces. However, you can configure an
interface manually as follows: interface manually as follows:
<programlisting> <programlisting>
<link linkend="opt-networking.interfaces._name__.ipv4.addresses">networking.interfaces.eth0.ipv4.addresses</link> = [ { <link linkend="opt-networking.interfaces._name_.ipv4.addresses">networking.interfaces.eth0.ipv4.addresses</link> = [ {
address = "192.168.1.2"; address = "192.168.1.2";
prefixLength = 24; prefixLength = 24;
} ]; } ];

View File

@ -26,7 +26,7 @@
As with IPv4 networking interfaces are automatically configured via DHCPv6. As with IPv4 networking interfaces are automatically configured via DHCPv6.
You can configure an interface manually: You can configure an interface manually:
<programlisting> <programlisting>
<link linkend="opt-networking.interfaces._name__.ipv6.addresses">networking.interfaces.eth0.ipv6.addresses</link> = [ { <link linkend="opt-networking.interfaces._name_.ipv6.addresses">networking.interfaces.eth0.ipv6.addresses</link> = [ {
address = "fe00:aa:bb:cc::2"; address = "fe00:aa:bb:cc::2";
prefixLength = 64; prefixLength = 64;
} ]; } ];

View File

@ -30,7 +30,7 @@ Enter passphrase for /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d: ***
<filename>/</filename>, add the following to <filename>/</filename>, add the following to
<filename>configuration.nix</filename>: <filename>configuration.nix</filename>:
<programlisting> <programlisting>
<link linkend="opt-boot.initrd.luks.devices._name__.device">boot.initrd.luks.devices.crypted.device</link> = "/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d"; <link linkend="opt-boot.initrd.luks.devices._name_.device">boot.initrd.luks.devices.crypted.device</link> = "/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d";
<xref linkend="opt-fileSystems"/>."/".device = "/dev/mapper/crypted"; <xref linkend="opt-fileSystems"/>."/".device = "/dev/mapper/crypted";
</programlisting> </programlisting>
Should grub be used as bootloader, and <filename>/boot</filename> is located Should grub be used as bootloader, and <filename>/boot</filename> is located
@ -60,13 +60,13 @@ Added to key to device /dev/sda2, slot: 2
To ensure that this file system is decrypted using the FIDO2 compatible key, add the following to <filename>configuration.nix</filename>: To ensure that this file system is decrypted using the FIDO2 compatible key, add the following to <filename>configuration.nix</filename>:
<programlisting> <programlisting>
<link linkend="opt-boot.initrd.luks.fido2Support">boot.initrd.luks.fido2Support</link> = true; <link linkend="opt-boot.initrd.luks.fido2Support">boot.initrd.luks.fido2Support</link> = true;
<link linkend="opt-boot.initrd.luks.devices._name__.fido2.credential">boot.initrd.luks.devices."/dev/sda2".fido2.credential</link> = "f1d00200108b9d6e849a8b388da457688e3dd653b4e53770012d8f28e5d3b269865038c346802f36f3da7278b13ad6a3bb6a1452e24ebeeaa24ba40eef559b1b287d2a2f80b7"; <link linkend="opt-boot.initrd.luks.devices._name_.fido2.credential">boot.initrd.luks.devices."/dev/sda2".fido2.credential</link> = "f1d00200108b9d6e849a8b388da457688e3dd653b4e53770012d8f28e5d3b269865038c346802f36f3da7278b13ad6a3bb6a1452e24ebeeaa24ba40eef559b1b287d2a2f80b7";
</programlisting> </programlisting>
You can also use the FIDO2 passwordless setup, but for security reasons, you might want to enable it only when your device is PIN protected, such as <link xlink:href="https://trezor.io/">Trezor</link>. You can also use the FIDO2 passwordless setup, but for security reasons, you might want to enable it only when your device is PIN protected, such as <link xlink:href="https://trezor.io/">Trezor</link>.
<programlisting> <programlisting>
<link linkend="opt-boot.initrd.luks.devices._name__.fido2.passwordLess">boot.initrd.luks.devices."/dev/sda2".fido2.passwordLess</link> = true; <link linkend="opt-boot.initrd.luks.devices._name_.fido2.passwordLess">boot.initrd.luks.devices."/dev/sda2".fido2.passwordLess</link> = true;
</programlisting> </programlisting>
</para> </para>
</section> </section>

View File

@ -19,7 +19,7 @@
All users that should have permission to change network settings must belong All users that should have permission to change network settings must belong
to the <code>networkmanager</code> group: to the <code>networkmanager</code> group:
<programlisting> <programlisting>
<link linkend="opt-users.users._name__.extraGroups">users.users.alice.extraGroups</link> = [ "networkmanager" ]; <link linkend="opt-users.users._name_.extraGroups">users.users.alice.extraGroups</link> = [ "networkmanager" ];
</programlisting> </programlisting>
</para> </para>

View File

@ -20,7 +20,7 @@
follows: follows:
<!-- FIXME: this might not work if the user is unmanaged. --> <!-- FIXME: this might not work if the user is unmanaged. -->
<programlisting> <programlisting>
<link linkend="opt-users.users._name__.openssh.authorizedKeys.keys">users.users.alice.openssh.authorizedKeys.keys</link> = <link linkend="opt-users.users._name_.openssh.authorizedKeys.keys">users.users.alice.openssh.authorizedKeys.keys</link> =
[ "ssh-dss AAAAB3NzaC1kc3MAAACBAPIkGWVEt4..." ]; [ "ssh-dss AAAAB3NzaC1kc3MAAACBAPIkGWVEt4..." ];
</programlisting> </programlisting>
</para> </para>

View File

@ -11,11 +11,11 @@
that a user account named <literal>alice</literal> shall exist: that a user account named <literal>alice</literal> shall exist:
<programlisting> <programlisting>
<xref linkend="opt-users.users"/>.alice = { <xref linkend="opt-users.users"/>.alice = {
<link linkend="opt-users.users._name__.isNormalUser">isNormalUser</link> = true; <link linkend="opt-users.users._name_.isNormalUser">isNormalUser</link> = true;
<link linkend="opt-users.users._name__.home">home</link> = "/home/alice"; <link linkend="opt-users.users._name_.home">home</link> = "/home/alice";
<link linkend="opt-users.users._name__.description">description</link> = "Alice Foobar"; <link linkend="opt-users.users._name_.description">description</link> = "Alice Foobar";
<link linkend="opt-users.users._name__.extraGroups">extraGroups</link> = [ "wheel" "networkmanager" ]; <link linkend="opt-users.users._name_.extraGroups">extraGroups</link> = [ "wheel" "networkmanager" ];
<link linkend="opt-users.users._name__.openssh.authorizedKeys.keys">openssh.authorizedKeys.keys</link> = [ "ssh-dss AAAAB3Nza... alice@foobar" ]; <link linkend="opt-users.users._name_.openssh.authorizedKeys.keys">openssh.authorizedKeys.keys</link> = [ "ssh-dss AAAAB3Nza... alice@foobar" ];
}; };
</programlisting> </programlisting>
Note that <literal>alice</literal> is a member of the Note that <literal>alice</literal> is a member of the
@ -36,7 +36,7 @@
account will cease to exist. Also, imperative commands for managing users and account will cease to exist. Also, imperative commands for managing users and
groups, such as useradd, are no longer available. Passwords may still be groups, such as useradd, are no longer available. Passwords may still be
assigned by setting the user's assigned by setting the user's
<link linkend="opt-users.users._name__.hashedPassword">hashedPassword</link> <link linkend="opt-users.users._name_.hashedPassword">hashedPassword</link>
option. A hashed password can be generated using <command>mkpasswd -m option. A hashed password can be generated using <command>mkpasswd -m
sha-512</command> after installing the <literal>mkpasswd</literal> package. sha-512</command> after installing the <literal>mkpasswd</literal> package.
</para> </para>

View File

@ -385,17 +385,6 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<varname>types.loaOf</varname> <replaceable>t</replaceable>
</term>
<listitem>
<para>
An attribute set or a list of <replaceable>t</replaceable> type. Multiple
definitions are merged according to the value.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<varname>types.nullOr</varname> <replaceable>t</replaceable> <varname>types.nullOr</varname> <replaceable>t</replaceable>

View File

@ -78,7 +78,7 @@
<literal>mutableUsers = false</literal>. Another way is to temporarily add <literal>mutableUsers = false</literal>. Another way is to temporarily add
the following to your configuration: the following to your configuration:
<screen> <screen>
<link linkend="opt-users.users._name__.initialHashedPassword">users.users.your-user.initialHashedPassword</link> = "test"; <link linkend="opt-users.users._name_.initialHashedPassword">users.users.your-user.initialHashedPassword</link> = "test";
</screen> </screen>
<emphasis>Important:</emphasis> delete the $hostname.qcow2 file if you have <emphasis>Important:</emphasis> delete the $hostname.qcow2 file if you have
started the virtual machine at least once without the right users, otherwise started the virtual machine at least once without the right users, otherwise

View File

@ -211,7 +211,7 @@ nixpkgs https://nixos.org/channels/nixpkgs-unstable</screen>
use <literal>sudo</literal>) use <literal>sudo</literal>)
</para> </para>
<programlisting> <programlisting>
<link linkend="opt-users.users._name__.initialHashedPassword">users.users.root.initialHashedPassword</link> = ""; <link linkend="opt-users.users._name_.initialHashedPassword">users.users.root.initialHashedPassword</link> = "";
</programlisting> </programlisting>
</listitem> </listitem>
<listitem> <listitem>

View File

@ -550,7 +550,7 @@ Retype new UNIX password: ***</screen>
# Note: setting fileSystems is generally not # Note: setting fileSystems is generally not
# necessary, since nixos-generate-config figures them out # necessary, since nixos-generate-config figures them out
# automatically in hardware-configuration.nix. # automatically in hardware-configuration.nix.
#<link linkend="opt-fileSystems._name__.device">fileSystems."/".device</link> = "/dev/disk/by-label/nixos"; #<link linkend="opt-fileSystems._name_.device">fileSystems."/".device</link> = "/dev/disk/by-label/nixos";
# Enable the OpenSSH server. # Enable the OpenSSH server.
services.sshd.enable = true; services.sshd.enable = true;

View File

@ -796,7 +796,7 @@ users.users.me =
or any other display manager in NixOS as they all support auto-login. If you used this module specifically or any other display manager in NixOS as they all support auto-login. If you used this module specifically
because it permitted root auto-login you can override the lightdm-autologin pam module like: because it permitted root auto-login you can override the lightdm-autologin pam module like:
<programlisting> <programlisting>
<link xlink:href="#opt-security.pam.services._name__.text">security.pam.services.lightdm-autologin.text</link> = lib.mkForce '' <link xlink:href="#opt-security.pam.services._name_.text">security.pam.services.lightdm-autologin.text</link> = lib.mkForce ''
auth requisite pam_nologin.so auth requisite pam_nologin.so
auth required pam_succeed_if.so quiet auth required pam_succeed_if.so quiet
auth required pam_permit.so auth required pam_permit.so

View File

@ -767,6 +767,16 @@ CREATE ROLE postgres LOGIN SUPERUSER;
See <link xlink:href="https://github.com/NixOS/nixpkgs/pull/82743#issuecomment-674520472">the PR that changed this</link> for more info. See <link xlink:href="https://github.com/NixOS/nixpkgs/pull/82743#issuecomment-674520472">the PR that changed this</link> for more info.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
For NixOS configuration options, the type <literal>loaOf</literal>, after
its initial deprecation in release 20.03, has been removed. In NixOS and
Nixpkgs options using this type have been converted to <literal>attrsOf</literal>.
For more information on this change have look at these links:
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/1800">issue #1800</link>,
<link xlink:href="https://github.com/NixOS/nixpkgs/pull/63103">PR #63103</link>.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>

View File

@ -20,7 +20,7 @@
<title>Configuration Options</title> <title>Configuration Options</title>
<variablelist xml:id="configuration-variable-list"> <variablelist xml:id="configuration-variable-list">
<xsl:for-each select="attrs"> <xsl:for-each select="attrs">
<xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '&lt;', '_'), '>', '_'), '?', '_'))" /> <xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '&lt;', '_'), '>', '_'))" />
<varlistentry> <varlistentry>
<term xlink:href="#{$id}"> <term xlink:href="#{$id}">
<xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute> <xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute>

View File

@ -463,7 +463,7 @@ in {
users.users = mkOption { users.users = mkOption {
default = {}; default = {};
type = with types; loaOf (submodule userOpts); type = with types; attrsOf (submodule userOpts);
example = { example = {
alice = { alice = {
uid = 1234; uid = 1234;
@ -487,7 +487,7 @@ in {
{ students.gid = 1001; { students.gid = 1001;
hackers = { }; hackers = { };
}; };
type = with types; loaOf (submodule groupOpts); type = with types; attrsOf (submodule groupOpts);
description = '' description = ''
Additional groups to be created automatically by the system. Additional groups to be created automatically by the system.
''; '';

View File

@ -27,7 +27,7 @@
}; };
fileSystems."/boot/firmware" = { fileSystems."/boot/firmware" = {
# This effectively "renames" the loaOf entry set in sd-image.nix # This effectively "renames" the attrsOf entry set in sd-image.nix
mountPoint = "/boot"; mountPoint = "/boot";
neededForBoot = true; neededForBoot = true;
}; };

View File

@ -224,7 +224,7 @@ bool optionTypeIs(Context & ctx, Value & v, const std::string & soughtType)
bool isAggregateOptionType(Context & ctx, Value & v) bool isAggregateOptionType(Context & ctx, Value & v)
{ {
return optionTypeIs(ctx, v, "attrsOf") || optionTypeIs(ctx, v, "listOf") || optionTypeIs(ctx, v, "loaOf"); return optionTypeIs(ctx, v, "attrsOf") || optionTypeIs(ctx, v, "listOf");
} }
MakeError(OptionPathError, EvalError); MakeError(OptionPathError, EvalError);

View File

@ -131,7 +131,7 @@ in
knownHosts = mkOption { knownHosts = mkOption {
default = {}; default = {};
type = types.loaOf (types.submodule ({ name, ... }: { type = types.attrsOf (types.submodule ({ name, ... }: {
options = { options = {
certAuthority = mkOption { certAuthority = mkOption {
type = types.bool; type = types.bool;

View File

@ -7,7 +7,7 @@ let
inherit (lib.modules) mkDefault mkIf; inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) literalExample mkEnableOption mkOption; inherit (lib.options) literalExample mkEnableOption mkOption;
inherit (lib.strings) concatStringsSep optionalString toLower; inherit (lib.strings) concatStringsSep optionalString toLower;
inherit (lib.types) addCheck attrsOf lines loaOf nullOr package path port str strMatching submodule; inherit (lib.types) addCheck attrsOf lines nullOr package path port str strMatching submodule;
# Checks if given list of strings contains unique # Checks if given list of strings contains unique
# elements when compared without considering case. # elements when compared without considering case.
@ -178,7 +178,7 @@ let
client system-options file "dsm.sys" client system-options file "dsm.sys"
''; '';
servers = mkOption { servers = mkOption {
type = loaOf (submodule [ serverOptions ]); type = attrsOf (submodule [ serverOptions ]);
default = {}; default = {};
example.mainTsmServer = { example.mainTsmServer = {
server = "tsmserver.company.com"; server = "tsmserver.company.com";

View File

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

View File

@ -220,7 +220,7 @@ let
}; };
destinations = mkOption { destinations = mkOption {
type = loaOf (destType config); type = attrsOf (destType config);
description = "Additional destinations."; description = "Additional destinations.";
default = {}; default = {};
example = literalExample '' example = literalExample ''
@ -328,7 +328,7 @@ in
}; };
zetup = mkOption { zetup = mkOption {
type = loaOf srcType; type = attrsOf srcType;
description = "Znapzend configuration."; description = "Znapzend configuration.";
default = {}; default = {};
example = literalExample '' example = literalExample ''

View File

@ -160,7 +160,7 @@ in
}; };
appConfig = mkOption { appConfig = mkOption {
type = types.loaOf appConfigModule; type = types.attrsOf appConfigModule;
default = {}; default = {};
example = literalExample '' example = literalExample ''
"com.github.app" = { "com.github.app" = {

View File

@ -81,7 +81,7 @@ 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 = with types; loaOf (submodule netDeviceOpts); type = with types; attrsOf (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.

View File

@ -3,7 +3,7 @@
let let
inherit (lib.options) literalExample mkEnableOption mkOption; inherit (lib.options) literalExample mkEnableOption mkOption;
inherit (lib.types) bool enum int lines loaOf nullOr path str submodule; inherit (lib.types) bool enum int lines attrsOf nullOr path str submodule;
inherit (lib.modules) mkDefault mkIf mkMerge; inherit (lib.modules) mkDefault mkIf mkMerge;
commonDescr = '' commonDescr = ''
@ -248,7 +248,7 @@ in
}; };
modems = mkOption { modems = mkOption {
type = loaOf (submodule [ modemConfigOptions ]); type = attrsOf (submodule [ modemConfigOptions ]);
default = {}; default = {};
example.ttyS1 = { example.ttyS1 = {
type = "cirrus"; type = "cirrus";

View File

@ -140,7 +140,7 @@ in
services.nylon = mkOption { services.nylon = mkOption {
default = {}; default = {};
description = "Collection of named nylon instances"; description = "Collection of named nylon instances";
type = with types; loaOf (submodule nylonOpts); type = with types; attrsOf (submodule nylonOpts);
internal = true; internal = true;
}; };

View File

@ -655,7 +655,7 @@ in
description = "Define the virtual hosts"; description = "Define the virtual hosts";
type = with types; loaOf (submodule vHostOpts); type = with types; attrsOf (submodule vHostOpts);
example = { example = {
myhost = { myhost = {

View File

@ -43,10 +43,10 @@ services.prosody = {
<link linkend="opt-services.prosody.ssl.cert">ssl.cert</link> = "/var/lib/acme/example.org/fullchain.pem"; <link linkend="opt-services.prosody.ssl.cert">ssl.cert</link> = "/var/lib/acme/example.org/fullchain.pem";
<link linkend="opt-services.prosody.ssl.key">ssl.key</link> = "/var/lib/acme/example.org/key.pem"; <link linkend="opt-services.prosody.ssl.key">ssl.key</link> = "/var/lib/acme/example.org/key.pem";
<link linkend="opt-services.prosody.virtualHosts">virtualHosts</link>."example.org" = { <link linkend="opt-services.prosody.virtualHosts">virtualHosts</link>."example.org" = {
<link linkend="opt-services.prosody.virtualHosts._name__.enabled">enabled</link> = true; <link linkend="opt-services.prosody.virtualHosts._name_.enabled">enabled</link> = true;
<link linkend="opt-services.prosody.virtualHosts._name__.domain">domain</link> = "example.org"; <link linkend="opt-services.prosody.virtualHosts._name_.domain">domain</link> = "example.org";
<link linkend="opt-services.prosody.virtualHosts._name__.ssl.cert">ssl.cert</link> = "/var/lib/acme/example.org/fullchain.pem"; <link linkend="opt-services.prosody.virtualHosts._name_.ssl.cert">ssl.cert</link> = "/var/lib/acme/example.org/fullchain.pem";
<link linkend="opt-services.prosody.virtualHosts._name__.ssl.key">ssl.key</link> = "/var/lib/acme/example.org/key.pem"; <link linkend="opt-services.prosody.virtualHosts._name_.ssl.key">ssl.key</link> = "/var/lib/acme/example.org/key.pem";
}; };
<link linkend="opt-services.prosody.muc">muc</link> = [ { <link linkend="opt-services.prosody.muc">muc</link> = [ {
<link linkend="opt-services.prosody.muc">domain</link> = "conference.example.org"; <link linkend="opt-services.prosody.muc">domain</link> = "conference.example.org";

View File

@ -361,7 +361,7 @@ in
}; };
users.users = mkOption { users.users = mkOption {
type = with types; loaOf (submodule userOptions); type = with types; attrsOf (submodule userOptions);
}; };
}; };

View File

@ -607,7 +607,7 @@ in
]; ];
} }
''; '';
type = types.loaOf (types.submodule ({name, ...}: { type = types.attrsOf (types.submodule ({name, ...}: {
options = { options = {
name = mkOption { name = mkOption {

View File

@ -516,7 +516,7 @@ in
<filename>/dev/mapper/<replaceable>name</replaceable></filename>. <filename>/dev/mapper/<replaceable>name</replaceable></filename>.
''; '';
type = with types; loaOf (submodule ( type = with types; attrsOf (submodule (
{ name, ... }: { options = { { name, ... }: { options = {
name = mkOption { name = mkOption {

View File

@ -558,7 +558,7 @@ in
}; };
fileSystems = mkOption { fileSystems = mkOption {
type = with lib.types; loaOf (submodule { type = with lib.types; attrsOf (submodule {
options.neededForBoot = mkOption { options.neededForBoot = mkOption {
default = false; default = false;
type = types.bool; type = types.bool;

View File

@ -46,7 +46,7 @@ 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>.
''; '';
type = with types; loaOf (submodule ( type = with types; attrsOf (submodule (
{ name, config, ... }: { name, config, ... }:
{ options = { { options = {

View File

@ -54,7 +54,7 @@ in
options = { options = {
fileSystems = mkOption { fileSystems = mkOption {
type = with lib.types; loaOf (submodule encryptedFSOptions); type = with lib.types; attrsOf (submodule encryptedFSOptions);
}; };
swapDevices = mkOption { swapDevices = mkOption {
type = with lib.types; listOf (submodule encryptedFSOptions); type = with lib.types; listOf (submodule encryptedFSOptions);

View File

@ -159,7 +159,7 @@ in
"/bigdisk".label = "bigdisk"; "/bigdisk".label = "bigdisk";
} }
''; '';
type = types.loaOf (types.submodule [coreFileSystemOpts fileSystemOpts]); type = types.attrsOf (types.submodule [coreFileSystemOpts fileSystemOpts]);
description = '' description = ''
The file systems to be mounted. It must include an entry for The file systems to be mounted. It must include an entry for
the root directory (<literal>mountPoint = "/"</literal>). Each the root directory (<literal>mountPoint = "/"</literal>). Each
@ -193,7 +193,7 @@ in
boot.specialFileSystems = mkOption { boot.specialFileSystems = mkOption {
default = {}; default = {};
type = types.loaOf (types.submodule coreFileSystemOpts); type = types.attrsOf (types.submodule coreFileSystemOpts);
internal = true; internal = true;
description = '' description = ''
Special filesystems that are mounted very early during boot. Special filesystems that are mounted very early during boot.

View File

@ -519,7 +519,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 = with types; loaOf (submodule interfaceOpts); type = with types; attrsOf (submodule interfaceOpts);
}; };
networking.vswitches = mkOption { networking.vswitches = mkOption {
@ -544,7 +544,7 @@ in
interfaces = mkOption { interfaces = mkOption {
example = [ "eth0" "eth1" ]; example = [ "eth0" "eth1" ];
description = "The physical network interfaces connected by the vSwitch."; description = "The physical network interfaces connected by the vSwitch.";
type = with types; loaOf (submodule vswitchInterfaceOpts); type = with types; attrsOf (submodule vswitchInterfaceOpts);
}; };
controllers = mkOption { controllers = mkOption {

View File

@ -627,7 +627,7 @@ in
}; };
bindMounts = mkOption { bindMounts = mkOption {
type = with types; loaOf (submodule bindMountOpts); type = with types; attrsOf (submodule bindMountOpts);
default = {}; default = {};
example = literalExample '' example = literalExample ''
{ "/home" = { hostPath = "/home/alice"; { "/home" = { hostPath = "/home/alice";

View File

@ -41,7 +41,7 @@ let
description = "Source for the in-container mount"; description = "Source for the in-container mount";
}; };
options = mkOption { options = mkOption {
type = loaOf (str); type = attrsOf (str);
default = [ "bind" ]; default = [ "bind" ];
description = '' description = ''
Mount options of the filesystem to be used. Mount options of the filesystem to be used.
@ -61,7 +61,7 @@ in
containers = mkOption { containers = mkOption {
default = {}; default = {};
description = "Declarative container configuration"; description = "Declarative container configuration";
type = with types; loaOf (submodule ({ name, config, ... }: { type = with types; attrsOf (submodule ({ name, config, ... }: {
options = { options = {
cmd = mkOption { cmd = mkOption {
type = types.lines; type = types.lines;