about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-19 13:13:51 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-19 18:24:37 +0200
commitf932910323bf7188f70c49789ce85392c36e06b4 (patch)
treebd659b920227481ec0c42994a2cde739f9859644 /lib
parente51ae0ecd3d4280397924d71a997726e97b284c4 (diff)
downloadnixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar.gz
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar.bz2
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar.lz
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar.xz
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.tar.zst
nixlib-f932910323bf7188f70c49789ce85392c36e06b4.zip
types.nix: Add ‘either’ type
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index f5700ab0269a..0e2b6515e165 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -200,6 +200,12 @@ rec {
       merge = mergeOneOption;
     };
 
+    either = t1: t2: mkOptionType {
+      name = "${t1.name} or ${t2.name}";
+      check = x: t1.check x || t2.check x;
+      merge = mergeOneOption;
+    };
+
     # Obsolete alternative to configOf.  It takes its option
     # declarations from the ‘options’ attribute of containing option
     # declaration.