diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index ece410ab55ab..851e9d72dc5c 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -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: