mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 06:45:54 +03:00
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";};
|
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user