···462462 config = addFreeformType (addMeta (m.config or {}));
463463 }
464464 else
465465+ lib.throwIfNot (isAttrs m) "module ${file} (${key}) does not look like a module."
465466 { _file = toString m._file or file;
466467 key = toString m.key or key;
467468 disabledModules = m.disabledModules or [];
+7
lib/tests/modules.sh
···194194## Paths should be allowed as values and work as expected
195195checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path.nix
196196197197+## deferredModule
198198+# default module is merged into nodes.foo
199199+checkConfigOutput '"beta"' config.nodes.foo.settingsDict.c ./deferred-module.nix
200200+# errors from the default module are reported with accurate location
201201+checkConfigError 'In `the-file-that-contains-the-bad-config.nix, via option default'\'': "bogus"' config.nodes.foo.bottom ./deferred-module.nix
202202+checkConfigError '.*lib/tests/modules/deferred-module-error.nix, via option deferred [(]:anon-1:anon-1:anon-1[)] does not look like a module.' config.result ./deferred-module-error.nix
203203+197204# Check the file location information is propagated into submodules
198205checkConfigOutput the-file.nix config.submodule.internalFiles.0 ./submoduleFiles.nix
199206
+20
lib/tests/modules/deferred-module-error.nix
···11+{ config, lib, ... }:
22+let
33+ inherit (lib) types mkOption setDefaultModuleLocation evalModules;
44+ inherit (types) deferredModule lazyAttrsOf submodule str raw enum;
55+in
66+{
77+ options = {
88+ deferred = mkOption {
99+ type = deferredModule;
1010+ };
1111+ result = mkOption {
1212+ default = (evalModules { modules = [ config.deferred ]; }).config.result;
1313+ };
1414+ };
1515+ config = {
1616+ deferred = { ... }:
1717+ # this should be an attrset, so this fails
1818+ true;
1919+ };
2020+}
···220220 requires using a function:
221221 `the-submodule = { ... }: { options = { ... }; }`.
222222223223+`types.deferredModule`
224224+225225+: Whereas `submodule` represents an option tree, `deferredModule` represents
226226+ a module value, such as a module file or a configuration.
227227+228228+ It can be set multiple times.
229229+230230+ Module authors can use its value in `imports`, in `submoduleWith`'s `modules`
231231+ or in `evalModules`' `modules` parameter, among other places.
232232+233233+ Note that `imports` must be evaluated before the module fixpoint. Because
234234+ of this, deferred modules can only be imported into "other" fixpoints, such
235235+ as submodules.
236236+237237+ One use case for this type is the type of a "default" module that allow the
238238+ user to affect all submodules in an `attrsOf submodule` at once. This is
239239+ more convenient and discoverable than expecting the module user to
240240+ type-merge with the `attrsOf submodule` option.
241241+223242## Composed Types {#sec-option-types-composed}
224243225244Composed types are types that take a type as parameter. `listOf
···427427 </itemizedlist>
428428 </listitem>
429429 </varlistentry>
430430+ <varlistentry>
431431+ <term>
432432+ <literal>types.deferredModule</literal>
433433+ </term>
434434+ <listitem>
435435+ <para>
436436+ Whereas <literal>submodule</literal> represents an option
437437+ tree, <literal>deferredModule</literal> represents a module
438438+ value, such as a module file or a configuration.
439439+ </para>
440440+ <para>
441441+ It can be set multiple times.
442442+ </para>
443443+ <para>
444444+ Module authors can use its value in
445445+ <literal>imports</literal>, in
446446+ <literal>submoduleWith</literal><quote>s
447447+ <literal>modules</literal> or in
448448+ <literal>evalModules</literal></quote>
449449+ <literal>modules</literal> parameter, among other places.
450450+ </para>
451451+ <para>
452452+ Note that <literal>imports</literal> must be evaluated
453453+ before the module fixpoint. Because of this, deferred
454454+ modules can only be imported into <quote>other</quote>
455455+ fixpoints, such as submodules.
456456+ </para>
457457+ <para>
458458+ One use case for this type is the type of a
459459+ <quote>default</quote> module that allow the user to affect
460460+ all submodules in an <literal>attrsOf submodule</literal> at
461461+ once. This is more convenient and discoverable than
462462+ expecting the module user to type-merge with the
463463+ <literal>attrsOf submodule</literal> option.
464464+ </para>
465465+ </listitem>
466466+ </varlistentry>
430467 </variablelist>
431468 </section>
432469 <section xml:id="sec-option-types-composed">
···11-WGET_ARGS=( https://download.kde.org/stable/release-service/22.04.1/src -A '*.tar.xz' )
11+WGET_ARGS=( https://download.kde.org/stable/release-service/22.04.2/src -A '*.tar.xz' )
···11-WGET_ARGS=( https://download.kde.org/stable/plasma/5.24.5/ -A '*.tar.xz' )
11+WGET_ARGS=( https://download.kde.org/stable/plasma/5.25.0/ -A '*.tar.xz' )
···11-WGET_ARGS=( https://download.kde.org/stable/frameworks/5.94/ -A '*.tar.xz' )
11+WGET_ARGS=( https://download.kde.org/stable/frameworks/5.95/ -A '*.tar.xz' )
···682682 letsencrypt = throw "'letsencrypt' has been renamed to/replaced by 'certbot'"; # Converted to throw 2022-02-22
683683 libGL_driver = throw "'libGL_driver' has been renamed to/replaced by 'mesa.drivers'"; # Converted to throw 2022-02-22
684684 libaudit = throw "'libaudit' has been renamed to/replaced by 'audit'"; # Converted to throw 2022-02-22
685685+ libbluedevil = throw "'libbluedevil' (Qt4) is unmaintained and unused since 'kde4.bluedevil's removal in 2017"; # Added 2022-06-14
685686 libcanberra_gtk2 = throw "'libcanberra_gtk2' has been renamed to/replaced by 'libcanberra-gtk2'"; # Converted to throw 2022-02-22
686687 libcanberra_gtk3 = throw "'libcanberra_gtk3' has been renamed to/replaced by 'libcanberra-gtk3'"; # Converted to throw 2022-02-22
687688 libcap_manpages = throw "'libcap_manpages' has been renamed to/replaced by 'libcap.doc'"; # Converted to throw 2022-02-22
···11681169 qflipper = qFlipper; # Added 2022-02-11
11691170 qmk_firmware = throw "qmk_firmware has been removed because it was broken"; # Added 2021-04-02
11701171 qr-filetransfer = throw ''"qr-filetransfer" has been renamed to "qrcp"''; # Added 2020-12-02
11721172+ qshowdiff = throw "'qshowdiff' (Qt4) is unmaintained and not been updated since its addition in 2010"; # Added 2022-06-14
11711173 qt-3 = throw "qt-3 has been removed from nixpkgs, as it's unmaintained and insecure"; # Added 2021-02-15
11721174 qt5ct = libsForQt5.qt5ct; # Added 2021-12-27
11731175 qtcurve = libsForQt5.qtcurve; # Added 2020-11-07