Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down