* A utility function `optionalAttrs', similar to optional and
optionalString but for attribute sets. svn path=/nixpkgs/trunk/; revision=17002
This commit is contained in:
parent
9d15693163
commit
5b7f46ea43
|
@ -161,4 +161,9 @@ rec {
|
||||||
/* Check whether the argument is a derivation. */
|
/* Check whether the argument is a derivation. */
|
||||||
isDerivation = x: isAttrs x && x ? type && x.type == "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 {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue