diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-09-26 00:03:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 00:03:58 +0000 |
commit | e0bea8e01773175988232c84b739b1c027bd1537 (patch) | |
tree | d028fbe48d4c0cb4447e5baf30b20851a7f35a92 /lib | |
parent | 3b8aa21fd1e7f703d809a8f0cada5d7badbc734c (diff) | |
parent | d2713c3294f1bfdd76fe96d30b8e9cb0b016d29c (diff) |
Merge staging-next into staging
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 1 | ||||
-rw-r--r-- | lib/types.nix | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index d3a7fac82c4ab..b6751d17f8f45 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -720,6 +720,7 @@ rec { inherit (res.defsFinal') highestPrio; definitions = map (def: def.value) res.defsFinal; files = map (def: def.file) res.defsFinal; + definitionsWithLocations = res.defsFinal; inherit (res) isDefined; # This allows options to be correctly displayed using `${options.path.to.it}` __toString = _: showOption loc; diff --git a/lib/types.nix b/lib/types.nix index 3750ba9655588..ed1d5f44064fe 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -119,8 +119,22 @@ rec { # - "composite": a phrase with an "of" connective # See the `optionDescriptionPhrase` function. , descriptionClass ? null - , # Function applied to each definition that should return true if - # its type-correct, false otherwise. + , # DO NOT USE WITHOUT KNOWING WHAT YOU ARE DOING! + # Function applied to each definition that must return false when a definition + # does not match the type. It should not check more than the root of the value, + # because checking nested values reduces laziness, leading to unnecessary + # infinite recursions in the module system. + # Further checks of nested values should be performed by throwing in + # the merge function. + # Strict and deep type checking can be performed by calling lib.deepSeq on + # the merged value. + # + # See https://github.com/NixOS/nixpkgs/pull/6794 that introduced this change, + # https://github.com/NixOS/nixpkgs/pull/173568 and + # https://github.com/NixOS/nixpkgs/pull/168295 that attempted to revert this, + # https://github.com/NixOS/nixpkgs/issues/191124 and + # https://github.com/NixOS/nixos-search/issues/391 for what happens if you ignore + # this disclaimer. check ? (x: true) , # Merge a list of definitions together into a single value. # This function is called with two arguments: the location of |