diff --git a/doc/functions.xml b/doc/functions.xml index 89f2fda0ad4..2aae3cfb2ae 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -85,4 +85,36 @@ in ... +
+ lib.makeOverridable + + + The function lib.makeOverridable is used make the result + of a function easily customizable. This utility only makes sense for functions + that accept an argument set and return an attribute set. + + + + Example usage: + + f = { a, b }: { result = a+b; } +c = lib.makeOverridable f { a = 1; b = 2; } + + + + + The variable c is the value of the f function + applied with some default arguments. Hence the value of c.result + is 3, in this example. + + + + The variable c however also has some additional functions, like + c.override which can be used to + override the default arguments. In this example the value of + (c.override { a = 4; }).result is 6. + + +
+