diff --git a/lib/types.nix b/lib/types.nix index e74775d0a27ad..62d6ac5501c2b 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -90,6 +90,9 @@ let '' payload.elemType; }; + # Custom that doesn't abort if NIX_ABORT_ON_WARN is set. + # This is needed for deprecations that are to big to change at once + deprecated = msg: v: builtins.trace "Deprecation warning: ${msg}" v; outer_types = rec { @@ -847,9 +850,14 @@ rec { }; # A submodule (like typed attribute set). See NixOS manual. - submodule = modules: submoduleWith { + submodule = deprecated "lib.types.submodule is deprecated, use lib.types.module instead" (modules: submoduleWith { shorthandOnlyDefinesConfig = true; modules = toList modules; + }); + + # Shorthand of moduleWith { modules = ...; } + module = modules: moduleWith { + modules = toList modules; }; # A module to be imported in some other part of the configuration. @@ -911,7 +919,8 @@ rec { in mergedOption.type; }; - submoduleWith = + submoduleWith = deprecated "lib.types.submoduleWith is deprecated, use types.moduleWith instead." moduleWith; + moduleWith = { modules , specialArgs ? {} , shorthandOnlyDefinesConfig ? false