query
On this page

optionalAttrs

lib.optionalAttrs

Docs pulled from | This Revision | 16 minutes ago


If cond is true, return the attribute set as, otherwise an empty attribute set.

Inputs

cond

Condition under which the as attribute set is returned.

as

The attribute set to return if cond is true.

Type

optionalAttrs :: Bool -> AttrSet -> AttrSet

Examples

lib.attrsets.optionalAttrs usage example

optionalAttrs (true) { my = "set"; }
=> { my = "set"; }
optionalAttrs (false) { my = "set"; }
=> { }
(lib.attrsets.optionalAttrs)

Noogle also knows

Aliases