3 # This script is used to test that the module system is working as expected.
4 # By default it test the version of nixpkgs which is defined in the NIX_PATH.
6 set -o errexit
-o noclobber
-o nounset
-o pipefail
7 shopt -s failglob inherit_errexit
9 # https://stackoverflow.com/a/246128/6605742
10 DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
20 local script="import ./default.nix { modules = [ $* ];}"
21 nix-instantiate
--timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode
27 local script="import ./default.nix { modules = [ $* ];}"
28 echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only"
29 evalConfig
"$attr" "$@" || true
34 local outputContains
=$1
36 if evalConfig
"$@" 2>/dev
/null |
grep --silent "$outputContains" ; then
39 echo 2>&1 "error: Expected result matching '$outputContains', while evaluating"
45 local errorContains
=$1
48 if err
="$(evalConfig "$@
" 2>&1 >/dev/null)"; then
49 echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
52 if echo "$err" |
grep -zP --silent "$errorContains" ; then
55 echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
61 # Shorthand meta attribute does not duplicate the config
62 checkConfigOutput
'^"one two"$' config.result .
/shorthand-meta.nix
64 # Check boolean option.
65 checkConfigOutput
'^false$' config.
enable .
/declare-enable.nix
66 checkConfigError
'The option .* does not exist. Definition values:\n\s*- In .*: true' config.
enable .
/define-enable.nix
68 checkConfigOutput
'^1$' config.bare-submodule.nested .
/declare-bare-submodule.nix .
/declare-bare-submodule-nested-option.nix
69 checkConfigOutput
'^2$' config.bare-submodule.deep .
/declare-bare-submodule.nix .
/declare-bare-submodule-deep-option.nix
70 checkConfigOutput
'^42$' config.bare-submodule.nested .
/declare-bare-submodule.nix .
/declare-bare-submodule-nested-option.nix .
/declare-bare-submodule-deep-option.nix .
/define-bare-submodule-values.nix
71 checkConfigOutput
'^420$' config.bare-submodule.deep .
/declare-bare-submodule.nix .
/declare-bare-submodule-nested-option.nix .
/declare-bare-submodule-deep-option.nix .
/define-bare-submodule-values.nix
72 checkConfigOutput
'^2$' config.bare-submodule.deep .
/declare-bare-submodule.nix .
/declare-bare-submodule-deep-option.nix .
/define-shorthandOnlyDefinesConfig-true.nix
73 checkConfigError
'The option .bare-submodule.deep. in .*/declare-bare-submodule-deep-option.nix. is already declared in .*/declare-bare-submodule-deep-option-duplicate.nix' config.bare-submodule.deep .
/declare-bare-submodule.nix .
/declare-bare-submodule-deep-option.nix .
/declare-bare-submodule-deep-option-duplicate.nix
75 # Check integer types.
77 checkConfigOutput
'^42$' config.value .
/declare-int-unsigned-value.nix .
/define-value-int-positive.nix
78 checkConfigError
'A definition for option .* is not of type.*unsigned integer.*. Definition values:\n\s*- In .*: -23' config.value .
/declare-int-unsigned-value.nix .
/define-value-int-negative.nix
80 checkConfigError
'A definition for option .* is not of type.*positive integer.*. Definition values:\n\s*- In .*: 0' config.value .
/declare-int-positive-value.nix .
/define-value-int-zero.nix
82 checkConfigOutput
'^42$' config.value .
/declare-int-between-value.nix .
/define-value-int-positive.nix
83 checkConfigError
'A definition for option .* is not of type.*between.*-21 and 43.*inclusive.*. Definition values:\n\s*- In .*: -23' config.value .
/declare-int-between-value.nix .
/define-value-int-negative.nix
87 checkConfigOutput
'^42$' config.value .
/declare-either.nix .
/define-value-int-positive.nix
88 checkConfigOutput
'^"24"$' config.value .
/declare-either.nix .
/define-value-string.nix
90 checkConfigOutput
'^42$' config.value .
/declare-oneOf.nix .
/define-value-int-positive.nix
91 checkConfigOutput
'^\[ \]$' config.value .
/declare-oneOf.nix .
/define-value-list.nix
92 checkConfigOutput
'^"24"$' config.value .
/declare-oneOf.nix .
/define-value-string.nix
94 # Check mkForce without submodules.
95 set -- config.
enable .
/declare-enable.nix .
/define-enable.nix
96 checkConfigOutput
'^true$' "$@"
97 checkConfigOutput
'^false$' "$@" .
/define-force-enable.nix
98 checkConfigOutput
'^false$' "$@" .
/define-enable-force.nix
100 # Check mkForce with option and submodules.
101 checkConfigError
'attribute .*foo.* .* not found' config.attrsOfSub.foo.
enable .
/declare-attrsOfSub-any-enable.nix
102 checkConfigOutput
'^false$' config.attrsOfSub.foo.
enable .
/declare-attrsOfSub-any-enable.nix .
/define-attrsOfSub-foo.nix
103 set -- config.attrsOfSub.foo.
enable .
/declare-attrsOfSub-any-enable.nix .
/define-attrsOfSub-foo-enable.nix
104 checkConfigOutput
'^true$' "$@"
105 checkConfigOutput
'^false$' "$@" .
/define-force-attrsOfSub-foo-enable.nix
106 checkConfigOutput
'^false$' "$@" .
/define-attrsOfSub-force-foo-enable.nix
107 checkConfigOutput
'^false$' "$@" .
/define-attrsOfSub-foo-force-enable.nix
108 checkConfigOutput
'^false$' "$@" .
/define-attrsOfSub-foo-enable-force.nix
110 # Check overriding effect of mkForce on submodule definitions.
111 checkConfigError
'attribute .*bar.* .* not found' config.attrsOfSub.bar.
enable .
/declare-attrsOfSub-any-enable.nix .
/define-attrsOfSub-foo.nix
112 checkConfigOutput
'^false$' config.attrsOfSub.bar.
enable .
/declare-attrsOfSub-any-enable.nix .
/define-attrsOfSub-foo.nix .
/define-attrsOfSub-bar.nix
113 set -- config.attrsOfSub.bar.
enable .
/declare-attrsOfSub-any-enable.nix .
/define-attrsOfSub-foo.nix .
/define-attrsOfSub-bar-enable.nix
114 checkConfigOutput
'^true$' "$@"
115 checkConfigError
'attribute .*bar.* .* not found' "$@" .
/define-force-attrsOfSub-foo-enable.nix
116 checkConfigError
'attribute .*bar.* .* not found' "$@" .
/define-attrsOfSub-force-foo-enable.nix
117 checkConfigOutput
'^true$' "$@" .
/define-attrsOfSub-foo-force-enable.nix
118 checkConfigOutput
'^true$' "$@" .
/define-attrsOfSub-foo-enable-force.nix
120 # Check mkIf with submodules.
121 checkConfigError
'attribute .*foo.* .* not found' config.attrsOfSub.foo.
enable .
/declare-enable.nix .
/declare-attrsOfSub-any-enable.nix
122 set -- config.attrsOfSub.foo.
enable .
/declare-enable.nix .
/declare-attrsOfSub-any-enable.nix
123 checkConfigError
'attribute .*foo.* .* not found' "$@" .
/define-if-attrsOfSub-foo-enable.nix
124 checkConfigError
'attribute .*foo.* .* not found' "$@" .
/define-attrsOfSub-if-foo-enable.nix
125 checkConfigError
'attribute .*foo.* .* not found' "$@" .
/define-attrsOfSub-foo-if-enable.nix
126 checkConfigOutput
'^false$' "$@" .
/define-attrsOfSub-foo-enable-if.nix
127 checkConfigOutput
'^true$' "$@" .
/define-enable.nix .
/define-if-attrsOfSub-foo-enable.nix
128 checkConfigOutput
'^true$' "$@" .
/define-enable.nix .
/define-attrsOfSub-if-foo-enable.nix
129 checkConfigOutput
'^true$' "$@" .
/define-enable.nix .
/define-attrsOfSub-foo-if-enable.nix
130 checkConfigOutput
'^true$' "$@" .
/define-enable.nix .
/define-attrsOfSub-foo-enable-if.nix
132 # Check disabledModules with config definitions and option declarations.
133 set -- config.
enable .
/define-enable.nix .
/declare-enable.nix
134 checkConfigOutput
'^true$' "$@"
135 checkConfigOutput
'^false$' "$@" .
/disable-define-enable.nix
136 checkConfigOutput
'^false$' "$@" .
/disable-define-enable-string-path.nix
137 checkConfigError
"The option .*enable.* does not exist. Definition values:\n\s*- In .*: true" "$@" .
/disable-declare-enable.nix
138 checkConfigError
"attribute .*enable.* in selection path .*config.enable.* not found" "$@" .
/disable-define-enable.nix .
/disable-declare-enable.nix
139 checkConfigError
"attribute .*enable.* in selection path .*config.enable.* not found" "$@" .
/disable-enable-modules.nix
141 # Check _module.args.
142 set -- config.
enable .
/declare-enable.nix .
/define-enable-with-custom-arg.nix
143 checkConfigError
'while evaluating the module argument .*custom.* in .*define-enable-with-custom-arg.nix.*:' "$@"
144 checkConfigOutput
'^true$' "$@" .
/define-_module-args-custom.nix
146 # Check that using _module.args on imports cause infinite recursions, with
147 # the proper error context.
148 set -- "$@" .
/define-_module-args-custom.nix .
/import-custom-arg.nix
149 checkConfigError
'while evaluating the module argument .*custom.* in .*import-custom-arg.nix.*:' "$@"
150 checkConfigError
'infinite recursion encountered' "$@"
152 # Check _module.check.
153 set -- config.
enable .
/declare-enable.nix .
/define-enable.nix .
/define-attrsOfSub-foo.nix
154 checkConfigError
'The option .* does not exist. Definition values:\n\s*- In .*' "$@"
155 checkConfigOutput
'^true$' "$@" .
/define-module-check.nix
157 # Check coerced value.
158 checkConfigOutput
'^"42"$' config.value .
/declare-coerced-value.nix
159 checkConfigOutput
'^"24"$' config.value .
/declare-coerced-value.nix .
/define-value-string.nix
160 checkConfigError
'A definition for option .* is not.*string or signed integer convertible to it.*. Definition values:\n\s*- In .*: \[ \]' config.value .
/declare-coerced-value.nix .
/define-value-list.nix
162 # Check coerced value with unsound coercion
163 checkConfigOutput
'^12$' config.value .
/declare-coerced-value-unsound.nix
164 checkConfigError
'A definition for option .* is not of type .*. Definition values:\n\s*- In .*: "1000"' config.value .
/declare-coerced-value-unsound.nix .
/define-value-string-bigint.nix
165 checkConfigError
'toInt: Could not convert .* to int' config.value .
/declare-coerced-value-unsound.nix .
/define-value-string-arbitrary.nix
167 # Check mkAliasOptionModule.
168 checkConfigOutput
'^true$' config.
enable .
/alias-with-priority.nix
169 checkConfigOutput
'^true$' config.enableAlias .
/alias-with-priority.nix
170 checkConfigOutput
'^false$' config.
enable .
/alias-with-priority-can-override.nix
171 checkConfigOutput
'^false$' config.enableAlias .
/alias-with-priority-can-override.nix
175 ## specialArgs should work
176 checkConfigOutput
'^"foo"$' config.submodule.foo .
/declare-submoduleWith-special.nix
178 ## shorthandOnlyDefines config behaves as expected
179 checkConfigOutput
'^true$' config.submodule.config .
/declare-submoduleWith-shorthand.nix .
/define-submoduleWith-shorthand.nix
180 checkConfigError
'is not of type `boolean' config.submodule.config .
/declare-submoduleWith-shorthand.nix .
/define-submoduleWith-noshorthand.nix
181 checkConfigError
"You're trying to declare a value of type \`bool'\n\s*rather than an attribute-set for the option" config.submodule.config .
/declare-submoduleWith-noshorthand.nix .
/define-submoduleWith-shorthand.nix
182 checkConfigOutput
'^true$' config.submodule.config .
/declare-submoduleWith-noshorthand.nix .
/define-submoduleWith-noshorthand.nix
184 ## submoduleWith should merge all modules in one swoop
185 checkConfigOutput
'^true$' config.submodule.inner .
/declare-submoduleWith-modules.nix
186 checkConfigOutput
'^true$' config.submodule.outer .
/declare-submoduleWith-modules.nix
187 # Should also be able to evaluate the type name (which evaluates freeformType,
188 # which evaluates all the modules defined by the type)
189 checkConfigOutput
'^"submodule"$' options.submodule.
type.description .
/declare-submoduleWith-modules.nix
191 ## submodules can be declared using (evalModules {...}).type
192 checkConfigOutput
'^true$' config.submodule.inner .
/declare-submodule-via-evalModules.nix
193 checkConfigOutput
'^true$' config.submodule.outer .
/declare-submodule-via-evalModules.nix
194 # Should also be able to evaluate the type name (which evaluates freeformType,
195 # which evaluates all the modules defined by the type)
196 checkConfigOutput
'^"submodule"$' options.submodule.
type.description .
/declare-submodule-via-evalModules.nix
198 ## Paths should be allowed as values and work as expected
199 checkConfigOutput
'^true$' config.submodule.
enable .
/declare-submoduleWith-path.nix
202 # default module is merged into nodes.foo
203 checkConfigOutput
'"beta"' config.nodes.foo.settingsDict.c .
/deferred-module.nix
204 # errors from the default module are reported with accurate location
205 checkConfigError
'In `the-file-that-contains-the-bad-config.nix, via option default'\'': "bogus"' config.nodes.foo.bottom .
/deferred-module.nix
206 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
208 # Check the file location information is propagated into submodules
209 checkConfigOutput the-file.nix config.submodule.internalFiles
.0 .
/submoduleFiles.nix
212 # Check that disabledModules works recursively and correctly
213 checkConfigOutput
'^true$' config.
enable .
/disable-recursive
/main.nix
214 checkConfigOutput
'^true$' config.
enable .
/disable-recursive
/{main.nix
,disable-foo.nix
}
215 checkConfigOutput
'^true$' config.
enable .
/disable-recursive
/{main.nix
,disable-bar.nix
}
216 checkConfigError
'The option .* does not exist. Definition values:\n\s*- In .*: true' config.
enable .
/disable-recursive
/{main.nix
,disable-foo.nix
,disable-bar.nix
}
218 # Check that imports can depend on derivations
219 checkConfigOutput
'^true$' config.
enable .
/import-from-store.nix
221 # Check that configs can be conditional on option existence
222 checkConfigOutput
'^true$' config.
enable .
/define-option-dependently.nix .
/declare-enable.nix .
/declare-int-positive-value.nix
223 checkConfigOutput
'^360$' config.value .
/define-option-dependently.nix .
/declare-enable.nix .
/declare-int-positive-value.nix
224 checkConfigOutput
'^7$' config.value .
/define-option-dependently.nix .
/declare-int-positive-value.nix
225 checkConfigOutput
'^true$' config.
set.
enable .
/define-option-dependently-nested.nix .
/declare-enable-nested.nix .
/declare-int-positive-value-nested.nix
226 checkConfigOutput
'^360$' config.
set.value .
/define-option-dependently-nested.nix .
/declare-enable-nested.nix .
/declare-int-positive-value-nested.nix
227 checkConfigOutput
'^7$' config.
set.value .
/define-option-dependently-nested.nix .
/declare-int-positive-value-nested.nix
229 # Check attrsOf and lazyAttrsOf. Only lazyAttrsOf should be lazy, and only
230 # attrsOf should work with conditional definitions
231 # In addition, lazyAttrsOf should honor an options emptyValue
232 checkConfigError
"is not lazy" config.isLazy .
/declare-attrsOf.nix .
/attrsOf-lazy-check.nix
233 checkConfigOutput
'^true$' config.isLazy .
/declare-lazyAttrsOf.nix .
/attrsOf-lazy-check.nix
234 checkConfigOutput
'^true$' config.conditionalWorks .
/declare-attrsOf.nix .
/attrsOf-conditional-check.nix
235 checkConfigOutput
'^false$' config.conditionalWorks .
/declare-lazyAttrsOf.nix .
/attrsOf-conditional-check.nix
236 checkConfigOutput
'^"empty"$' config.value.foo .
/declare-lazyAttrsOf.nix .
/attrsOf-conditional-check.nix
239 # Even with multiple assignments, a type error should be thrown if any of them aren't valid
240 checkConfigError
'A definition for option .* is not of type .*' \
241 config.value .
/declare-int-unsigned-value.nix .
/define-value-list.nix .
/define-value-int-positive.nix
244 # Assigning without a declared option should work
245 checkConfigOutput
'^"24"$' config.value .
/freeform-attrsOf.nix .
/define-value-string.nix
246 # No freeform assigments shouldn't make it error
247 checkConfigOutput
'^{ }$' config .
/freeform-attrsOf.nix
248 # but only if the type matches
249 checkConfigError
'A definition for option .* is not of type .*' config.value .
/freeform-attrsOf.nix .
/define-value-list.nix
250 # and properties should be applied
251 checkConfigOutput
'^"yes"$' config.value .
/freeform-attrsOf.nix .
/define-value-string-properties.nix
252 # Options should still be declarable, and be able to have a type that doesn't match the freeform type
253 checkConfigOutput
'^false$' config.
enable .
/freeform-attrsOf.nix .
/define-value-string.nix .
/declare-enable.nix
254 checkConfigOutput
'^"24"$' config.value .
/freeform-attrsOf.nix .
/define-value-string.nix .
/declare-enable.nix
255 # and this should work too with nested values
256 checkConfigOutput
'^false$' config.nest.foo .
/freeform-attrsOf.nix .
/freeform-nested.nix
257 checkConfigOutput
'^"bar"$' config.nest.bar .
/freeform-attrsOf.nix .
/freeform-nested.nix
258 # Check whether a declared option can depend on an freeform-typed one
259 checkConfigOutput
'^null$' config.foo .
/freeform-attrsOf.nix .
/freeform-str-dep-unstr.nix
260 checkConfigOutput
'^"24"$' config.foo .
/freeform-attrsOf.nix .
/freeform-str-dep-unstr.nix .
/define-value-string.nix
261 # Check whether an freeform-typed value can depend on a declared option, this can only work with lazyAttrsOf
262 checkConfigError
'infinite recursion encountered' config.foo .
/freeform-attrsOf.nix .
/freeform-unstr-dep-str.nix
263 checkConfigError
'The option .* is used but not defined' config.foo .
/freeform-lazyAttrsOf.nix .
/freeform-unstr-dep-str.nix
264 checkConfigOutput
'^"24"$' config.foo .
/freeform-lazyAttrsOf.nix .
/freeform-unstr-dep-str.nix .
/define-value-string.nix
265 # submodules in freeformTypes should have their locations annotated
266 checkConfigOutput
'/freeform-submodules.nix"$' config.fooDeclarations
.0 .
/freeform-submodules.nix
267 # freeformTypes can get merged using `types.type`, including submodules
268 checkConfigOutput
'^10$' config.free.xxx.foo .
/freeform-submodules.nix
269 checkConfigOutput
'^10$' config.free.yyy.bar .
/freeform-submodules.nix
272 # Check that attribute sets are merged recursively
273 checkConfigOutput
'^null$' config.value.foo .
/types-anything
/nested-attrs.nix
274 checkConfigOutput
'^null$' config.value.l1.foo .
/types-anything
/nested-attrs.nix
275 checkConfigOutput
'^null$' config.value.l1.l2.foo .
/types-anything
/nested-attrs.nix
276 checkConfigOutput
'^null$' config.value.l1.l2.l3.foo .
/types-anything
/nested-attrs.nix
277 # Attribute sets that are coercible to strings shouldn't be recursed into
278 checkConfigOutput
'^"foo"$' config.value.outPath .
/types-anything
/attrs-coercible.nix
279 # Multiple lists aren't concatenated together
280 checkConfigError
'The option .* has conflicting definitions' config.value .
/types-anything
/lists.nix
281 # Check that all equalizable atoms can be used as long as all definitions are equal
282 checkConfigOutput
'^0$' config.value.int .
/types-anything
/equal-atoms.nix
283 checkConfigOutput
'^false$' config.value.bool .
/types-anything
/equal-atoms.nix
284 checkConfigOutput
'^""$' config.value.string .
/types-anything
/equal-atoms.nix
285 checkConfigOutput
'^/$' config.value.path .
/types-anything
/equal-atoms.nix
286 checkConfigOutput
'^null$' config.value.null .
/types-anything
/equal-atoms.nix
287 checkConfigOutput
'^0.1$' config.value.float .
/types-anything
/equal-atoms.nix
288 # Functions can't be merged together
289 checkConfigError
"The option .value.multiple-lambdas.<function body>. has conflicting option types" config.applied.multiple-lambdas .
/types-anything
/functions.nix
290 checkConfigOutput
'^<LAMBDA>$' config.value.single-lambda .
/types-anything
/functions.nix
291 checkConfigOutput
'^null$' config.applied.merging-lambdas.x .
/types-anything
/functions.nix
292 checkConfigOutput
'^null$' config.applied.merging-lambdas.y .
/types-anything
/functions.nix
293 # Check that all mk* modifiers are applied
294 checkConfigError
'attribute .* not found' config.value.mkiffalse .
/types-anything
/mk-mods.nix
295 checkConfigOutput
'^{ }$' config.value.mkiftrue .
/types-anything
/mk-mods.nix
296 checkConfigOutput
'^1$' config.value.mkdefault .
/types-anything
/mk-mods.nix
297 checkConfigOutput
'^{ }$' config.value.mkmerge .
/types-anything
/mk-mods.nix
298 checkConfigOutput
'^true$' config.value.mkbefore .
/types-anything
/mk-mods.nix
299 checkConfigOutput
'^1$' config.value.nested.foo .
/types-anything
/mk-mods.nix
300 checkConfigOutput
'^"baz"$' config.value.nested.bar.baz .
/types-anything
/mk-mods.nix
303 checkConfigOutput
'^"input is input"$' config.result .
/functionTo
/trivial.nix
304 checkConfigOutput
'^"a b"$' config.result .
/functionTo
/merging-list.nix
305 checkConfigError
'A definition for option .fun.<function body>. is not of type .string.. Definition values:\n\s*- In .*wrong-type.nix' config.result .
/functionTo
/wrong-type.nix
306 checkConfigOutput
'^"b a"$' config.result .
/functionTo
/list-order.nix
307 checkConfigOutput
'^"a c"$' config.result .
/functionTo
/merging-attrs.nix
308 checkConfigOutput
'^"a bee"$' config.result .
/functionTo
/submodule-options.nix
309 checkConfigOutput
'^"fun.<function body>.a fun.<function body>.b"$' config.optionsResult .
/functionTo
/submodule-options.nix
312 checkConfigOutput
'^"a b"$' config.resultFoo .
/declare-variants.nix .
/define-variant.nix
313 checkConfigOutput
'^"a b y z"$' config.resultFooBar .
/declare-variants.nix .
/define-variant.nix
314 checkConfigOutput
'^"a b c"$' config.resultFooFoo .
/declare-variants.nix .
/define-variant.nix
317 checkConfigOutput
"[ ]" config.list.a .
/emptyValues.nix
318 checkConfigOutput
"{ }" config.attrs.a .
/emptyValues.nix
319 checkConfigOutput
"null" config.null.a .
/emptyValues.nix
320 checkConfigOutput
"{ }" config.submodule.a .
/emptyValues.nix
321 # These types don't have empty values
322 checkConfigError
'The option .int.a. is used but not defined' config.int.a .
/emptyValues.nix
323 checkConfigError
'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a .
/emptyValues.nix
326 checkConfigOutput
"{ foo = <CODE>; }" config.unprocessedNesting .
/raw.nix
327 checkConfigOutput
"10" config.processedToplevel .
/raw.nix
328 checkConfigError
"The option .multiple. is defined multiple times" config.multiple .
/raw.nix
329 checkConfigOutput
"bar" config.priorities .
/raw.nix
333 'The option .set. in module .*/declare-set.nix. would be a parent of the following options, but its type .attribute set of signed integer. does not support nested options.\n\s*- option[(]s[)] with prefix .set.enable. in module .*/declare-enable-nested.nix.' \
335 .
/declare-set.nix .
/declare-enable-nested.nix
337 # Test that types.optionType merges types correctly
338 checkConfigOutput
'^10$' config.theOption.int .
/optionTypeMerging.nix
339 checkConfigOutput
'^"hello"$' config.theOption.str .
/optionTypeMerging.nix
341 # Test that types.optionType correctly annotates option locations
342 checkConfigError
'The option .theOption.nested. in .other.nix. is already declared in .optionTypeFile.nix.' config.theOption.nested .
/optionTypeFile.nix
344 # Test that types.optionType leaves types untouched as long as they don't need to be merged
345 checkConfigOutput
'ok' config.freeformItems.foo.bar .
/adhoc-freeformType-survives-type-merge.nix
347 # Anonymous submodules don't get nixed by import resolution/deduplication
348 # because of an `extendModules` bug, issue 168767.
349 checkConfigOutput
'^1$' config.sub.specialisation.value .
/extendModules-168767-imports.nix
351 # doRename works when `warnings` does not exist.
352 checkConfigOutput
'^1234$' config.c.d.e .
/doRename-basic.nix
353 # doRename adds a warning.
354 checkConfigOutput
'^"The option `a\.b. defined in `.*/doRename-warnings\.nix. has been renamed to `c\.d\.e.\."$' \
356 .
/doRename-warnings.nix
359 ====== module tests ======
364 if [ "$fail" -ne 0 ]; then