From 0ada9fff8a86dc582ebee158107d4f942e865ab0 Mon Sep 17 00:00:00 2001 From: piegames Date: Fri, 16 Sep 2022 14:14:59 +0200 Subject: lib/types.nix: Document that it should not be used Co-authored-by: Robert Hensing Co-authored-by: Valentin Gagarin --- lib/types.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/types.nix') 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 -- cgit 1.4.1