simplified isOption reusing typeOf

svn path=/nixpkgs/trunk/; revision=13119
This commit is contained in:
Marc Weber 2008-10-26 17:44:23 +00:00
parent 2cb8e66b8f
commit a9b19788fb

View File

@ -347,12 +347,9 @@ rec {
mkOption = attrs: attrs // {_type = "option";}; 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: isOption = attrs: (typeOf attrs) == "option";
__isAttrs attrs
&& attrs ? _type
&& attrs._type == "option";
addDefaultOptionValues = defs: opts: opts // addDefaultOptionValues = defs: opts: opts //
builtins.listToAttrs (map (defName: builtins.listToAttrs (map (defName: