From a9b19788fb574871bd27054e77b361f7f1413319 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 26 Oct 2008 17:44:23 +0000 Subject: [PATCH] simplified isOption reusing typeOf svn path=/nixpkgs/trunk/; revision=13119 --- pkgs/lib/default.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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: