···633633 optionDecls = filter
634634 (m: m.options?_type
635635 && (m.options._type == "option"
636636- || throwDeclarationTypeError loc m.options._type
636636+ || throwDeclarationTypeError loc m.options._type m._file
637637 )
638638 )
639639 decls;
···698698 ) unmatchedDefnsByName);
699699 };
700700701701- throwDeclarationTypeError = loc: actualTag:
701701+ throwDeclarationTypeError = loc: actualTag: file:
702702 let
703703 name = lib.strings.escapeNixIdentifier (lib.lists.last loc);
704704 path = showOption loc;
705705 depth = length loc;
706706707707 paragraphs = [
708708- "Expected an option declaration at option path `${path}` but got an attribute set with type ${actualTag}"
708708+ "In module ${file}: expected an option declaration at option path `${path}` but got an attribute set with type ${actualTag}"
709709 ] ++ optional (actualTag == "option-type") ''
710710 When declaring an option, you must wrap the type in a `mkOption` call. It should look somewhat like:
711711 ${comment}
+3-3
lib/tests/modules.sh
···394394 ./declare-set.nix ./declare-enable-nested.nix
395395396396# Options: accidental use of an option-type instead of option (or other tagged type; unlikely)
397397-checkConfigError 'Expected an option declaration at option path .result. but got an attribute set with type option-type' config.result ./options-type-error-typical.nix
398398-checkConfigError 'Expected an option declaration at option path .result.here. but got an attribute set with type option-type' config.result.here ./options-type-error-typical-nested.nix
399399-checkConfigError 'Expected an option declaration at option path .result. but got an attribute set with type configuration' config.result ./options-type-error-configuration.nix
397397+checkConfigError 'In module .*/options-type-error-typical.nix: expected an option declaration at option path .result. but got an attribute set with type option-type' config.result ./options-type-error-typical.nix
398398+checkConfigError 'In module .*/options-type-error-typical-nested.nix: expected an option declaration at option path .result.here. but got an attribute set with type option-type' config.result.here ./options-type-error-typical-nested.nix
399399+checkConfigError 'In module .*/options-type-error-configuration.nix: expected an option declaration at option path .result. but got an attribute set with type configuration' config.result ./options-type-error-configuration.nix
400400401401# Check that that merging of option collisions doesn't depend on type being set
402402checkConfigError 'The option .group..*would be a parent of the following options, but its type .<no description>. does not support nested options.\n\s*- option.s. with prefix .group.enable..*' config.group.enable ./merge-typeless-option.nix