forked from mirrors/nixpkgs
simplified isOption reusing typeOf
svn path=/nixpkgs/trunk/; revision=13119
This commit is contained in:
parent
2cb8e66b8f
commit
a9b19788fb
|
@ -347,12 +347,9 @@ rec {
|
|||
|
||||
mkOption = attrs: attrs // {_type = "option";};
|
||||
|
||||
typeOf = x: if x ? _type then x._type else "";
|
||||
typeOf = x: if (__isAttrs x && x ? _type) then x._type else "";
|
||||
|
||||
isOption = attrs:
|
||||
__isAttrs attrs
|
||||
&& attrs ? _type
|
||||
&& attrs._type == "option";
|
||||
isOption = attrs: (typeOf attrs) == "option";
|
||||
|
||||
addDefaultOptionValues = defs: opts: opts //
|
||||
builtins.listToAttrs (map (defName:
|
||||
|
|
Loading…
Reference in a new issue