types.nix: Add ‘either’ type

This commit is contained in:
Eelco Dolstra 2014-08-19 13:13:51 +02:00
parent e51ae0ecd3
commit f932910323

View file

@ -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.