mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
* 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
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue