* A utility function `optionalAttrs', similar to optional and

optionalString but for attribute sets.

svn path=/nixpkgs/trunk/; revision=17002
This commit is contained in:
Eelco Dolstra 2009-09-10 10:52:51 +00:00
parent 9d15693163
commit 5b7f46ea43

View File

@ -161,4 +161,9 @@ rec {
/* Check whether the argument is a derivation. */
isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
/* If the Boolean `cond' is true, return the attribute set `as',
otherwise an empty attribute set. */
optionalAttrs = cond: as: if cond then as else {};
}