···
mergeDefinitions loc opt.type defs';
369
-
# The value with a check that it is defined
370
-
valueDefined = if res.isDefined then res.mergedValue else
371
-
# (nixos-option detects this specific error message and gives it special
372
-
# handling. If changed here, please change it there too.)
373
-
throw "The option `${showOption loc}' is used but not defined.";
# Apply the 'apply' function to the merged value. This allows options to
# yield a value computed from the definitions
377
-
value = if opt ? apply then opt.apply valueDefined else valueDefined;
370
+
value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
{ value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
···
defsFinal = defsFinal'.values;
411
-
# Type-check the remaining definitions, and merge them.
412
-
mergedValue = foldl' (res: def:
413
-
if type.check def.value then res
414
-
else throw "The option value `${showOption loc}' in `${def.file}' is not of type `${type.description}'.")
415
-
(type.merge loc defsFinal) defsFinal;
404
+
# Type-check the remaining definitions, and merge them. Or throw if no definitions.
408
+
if type.check def.value then res
409
+
else throw "The option value `${showOption loc}' in `${def.file}' is not of type `${type.description}'."
410
+
) (type.merge loc defsFinal) defsFinal
412
+
# (nixos-option detects this specific error message and gives it special
413
+
# handling. If changed here, please change it there too.)
414
+
throw "The option `${showOption loc}' is used but not defined.";
isDefined = defsFinal != [];