mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
Add a common pattern used in jobs definition.
svn path=/nixpkgs/trunk/; revision=13370
This commit is contained in:
parent
26212b62c7
commit
b62298f7c7
@ -233,6 +233,16 @@ rec {
|
||||
|
||||
optionalString = cond: string: if cond then string else "";
|
||||
|
||||
# Return the second argument if the first one is true or the empty version
|
||||
# of the second argument.
|
||||
ifEnable = cond: val:
|
||||
if cond then val
|
||||
else if builtins.isList val then []
|
||||
else if builtins.isAttrs val then {}
|
||||
# else if builtins.isString val then ""
|
||||
# else if builtins.isBoolean val then false
|
||||
else null;
|
||||
|
||||
# Return a list of integers from `first' up to and including `last'.
|
||||
range = first: last:
|
||||
if builtins.lessThan last first
|
||||
|
Loading…
Reference in New Issue
Block a user