about summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorpiegames <git@piegames.de>2022-09-16 14:14:59 +0200
committerpiegames <git@piegames.de>2022-09-25 16:37:15 +0200
commit0ada9fff8a86dc582ebee158107d4f942e865ab0 (patch)
treedfac05b1913e09fa13ecfb0eb5dcfacd1e69bb65 /lib/types.nix
parent5f379c4b68edfda8326b1c4d173b75975668ded3 (diff)
lib/types.nix: Document that it should not be used
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix18
1 files changed, 16 insertions, 2 deletions
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