diff --git a/lib/modules.nix b/lib/modules.nix index 938b17bd3b92..8b26f2c462e8 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1138,15 +1138,13 @@ let # Apply the 'apply' function to the merged value. This allows options to # yield a value computed from the definitions value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue; - - warnDeprecation = - if (opt.type.deprecationMessage != null) then - warn "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}" - else - x: x; - in - warnDeprecation opt + ( + if opt.type.deprecationMessage != null then + warn "The type `types.${opt.type.name}' of option `${showOption loc}' 'defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}" opt + else + opt + ) // { value = addErrorContext "while evaluating the option `${showOption loc}':" value; inherit (res.defsFinal') highestPrio;