summary refs log tree commit diff
path: root/lib/types.nix
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/types.nix
parente51ae0ecd3d4280397924d71a997726e97b284c4 (diff)
downloadnixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar.gz
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar.bz2
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar.lz
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar.xz
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.tar.zst
nixpkgs-f932910323bf7188f70c49789ce85392c36e06b4.zip
types.nix: Add ‘either’ type
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index f5700ab0269..0e2b6515e16 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.