From e0c6981d19d39d41258ab626a6b9871ff0014af2 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 12 Oct 2018 15:42:39 -0400 Subject: [PATCH] nixpkgs docs: document optionalAttrs --- doc/functions/library/attrsets.xml | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index 222b4a88291..8206142d7df 100644 --- a/doc/functions/library/attrsets.xml +++ b/doc/functions/library/attrsets.xml @@ -1300,4 +1300,57 @@ lib.attrsets.isDerivation "foobar" + +
+ <function>lib.attrsets.optionalAttrs</function> + + optionalAttrs :: Bool -> AttrSet + + + + + + Conditionally return an attribute set or an empty attribute set. + + + + + + cond + + + + Condition under which the as attribute set is + returned. + + + + + + as + + + + The attribute set to return if cond is true. + + + + + + + Return the provided attribute set when <varname>cond</varname> is true + { my = "set"; } + ]]> + + + + Return an empty attribute set when <varname>cond</varname> is false + { } + ]]> + +