summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2008-10-26 17:44:23 +0000
committerMarc Weber <marco-oweber@gmx.de>2008-10-26 17:44:23 +0000
commita9b19788fb574871bd27054e77b361f7f1413319 (patch)
tree147788706401e12dfcaed8e587d58b2b3f9edc67
parent2cb8e66b8f5f8d09b0a2a9a1a9b82ec66c3dfb73 (diff)
downloadnixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar.gz
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar.bz2
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar.lz
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar.xz
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.tar.zst
nixpkgs-a9b19788fb574871bd27054e77b361f7f1413319.zip
simplified isOption reusing typeOf
svn path=/nixpkgs/trunk/; revision=13119
-rw-r--r--pkgs/lib/default.nix7
1 files changed, 2 insertions, 5 deletions
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix
index ece410ab55a..851e9d72dc5 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: