about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/modules.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index a7fbec93a2f51..204a2cc1ac12a 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -1135,10 +1135,10 @@ rec {
         type = toType;
       });
       config = mkMerge [
-        {
+        (optionalAttrs (options ? warnings) {
           warnings = optional (warn && fromOpt.isDefined)
             "The option `${showOption from}' defined in ${showFiles fromOpt.files} has been renamed to `${showOption to}'.";
-        }
+        })
         (if withPriority
           then mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt
           else mkAliasAndWrapDefinitions (setAttrByPath to) fromOpt)