summary refs log tree commit diff
path: root/pkgs/lib/types.nix
diff options
context:
space:
mode:
authorEvgeny Egorochkin <phreedom@yandex.ru>2013-03-13 15:05:30 +0100
committerEvgeny Egorochkin <phreedom@yandex.ru>2013-08-22 23:17:30 +0300
commit993deb1a4a96971f0de41fa596bb2ddd134ef171 (patch)
tree21ea8505b277940a977d87f118d90e10ecab7a07 /pkgs/lib/types.nix
parent6c97e9ef722e60d93b843254cd90591ed26bda97 (diff)
downloadnixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar.gz
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar.bz2
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar.lz
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar.xz
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.tar.zst
nixpkgs-993deb1a4a96971f0de41fa596bb2ddd134ef171.zip
Hopefully a fixed version of Refactor: introduce isType reducing redundancy.
Coding-by-sed wasn't a good idea :(
Diffstat (limited to 'pkgs/lib/types.nix')
-rw-r--r--pkgs/lib/types.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/lib/types.nix b/pkgs/lib/types.nix
index 9dce885b182..156d72ac5e7 100644
--- a/pkgs/lib/types.nix
+++ b/pkgs/lib/types.nix
@@ -10,6 +10,7 @@ with import ./trivial.nix;
 
 rec {
 
+  isType = type: x: (x._type or "") == type;
   hasType = x: isAttrs x && x ? _type;
   typeOf = x: x._type or "";
 
@@ -26,7 +27,7 @@ rec {
   # hasOptions (boolean: whatever this option contains an option set)
   # delayOnGlobalEval (boolean: should properties go through the evaluation of this option)
   # docPath (path concatenated to the option name contained in the option set)
-  isOptionType = attrs: typeOf attrs == "option-type";
+  isOptionType = isType "option-type";
   mkOptionType =
     { name
     , check ? (x: true)