parent
12de4d5cb3
commit
363e6978ce
|
@ -230,11 +230,18 @@ rec {
|
||||||
substSubModules = m: submodule m;
|
substSubModules = m: submodule m;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum = values: mkOptionType {
|
enum = values:
|
||||||
name = "one of ${concatStringsSep ", " values}";
|
let
|
||||||
check = flip elem values;
|
show = v:
|
||||||
merge = mergeOneOption;
|
if builtins.isString v then ''"${v}"''
|
||||||
};
|
else if builtins.isInt v then builtins.toString v
|
||||||
|
else ''<${builtins.typeOf v}>'';
|
||||||
|
in
|
||||||
|
mkOptionType {
|
||||||
|
name = "one of ${concatMapStringsSep ", " show values}";
|
||||||
|
check = flip elem values;
|
||||||
|
merge = mergeOneOption;
|
||||||
|
};
|
||||||
|
|
||||||
either = t1: t2: mkOptionType {
|
either = t1: t2: mkOptionType {
|
||||||
name = "${t1.name} or ${t2.name}";
|
name = "${t1.name} or ${t2.name}";
|
||||||
|
|
Loading…
Reference in New Issue