diff options
author | Evgeny Egorochkin <phreedom@yandex.ru> | 2013-03-13 15:05:30 +0100 |
---|---|---|
committer | Evgeny Egorochkin <phreedom@yandex.ru> | 2013-08-22 23:17:30 +0300 |
commit | 993deb1a4a96971f0de41fa596bb2ddd134ef171 (patch) | |
tree | 21ea8505b277940a977d87f118d90e10ecab7a07 /pkgs/lib/types.nix | |
parent | 6c97e9ef722e60d93b843254cd90591ed26bda97 (diff) | |
download | nixpkgs-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.nix | 3 |
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) |