mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-31 06:31:20 +00:00
Merge pull request #65380 from danbst/int-merge-one-option
lib/types: change merge strategy for `str`, `int`, `float`, `path` and `enum`
This commit is contained in:
commit
377cd8a1ea
@ -111,7 +111,7 @@ rec {
|
|||||||
name = "int";
|
name = "int";
|
||||||
description = "signed integer";
|
description = "signed integer";
|
||||||
check = isInt;
|
check = isInt;
|
||||||
merge = mergeOneOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Specialized subdomains of int
|
# Specialized subdomains of int
|
||||||
@ -176,14 +176,14 @@ rec {
|
|||||||
name = "float";
|
name = "float";
|
||||||
description = "floating point number";
|
description = "floating point number";
|
||||||
check = isFloat;
|
check = isFloat;
|
||||||
merge = mergeOneOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
str = mkOptionType {
|
str = mkOptionType {
|
||||||
name = "str";
|
name = "str";
|
||||||
description = "string";
|
description = "string";
|
||||||
check = isString;
|
check = isString;
|
||||||
merge = mergeOneOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
strMatching = pattern: mkOptionType {
|
strMatching = pattern: mkOptionType {
|
||||||
@ -243,7 +243,7 @@ rec {
|
|||||||
name = "path";
|
name = "path";
|
||||||
# Hacky: there is no ‘isPath’ primop.
|
# Hacky: there is no ‘isPath’ primop.
|
||||||
check = x: builtins.substring 0 1 (toString x) == "/";
|
check = x: builtins.substring 0 1 (toString x) == "/";
|
||||||
merge = mergeOneOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
# drop this in the future:
|
# drop this in the future:
|
||||||
@ -415,7 +415,7 @@ rec {
|
|||||||
name = "enum";
|
name = "enum";
|
||||||
description = "one of ${concatMapStringsSep ", " show values}";
|
description = "one of ${concatMapStringsSep ", " show values}";
|
||||||
check = flip elem values;
|
check = flip elem values;
|
||||||
merge = mergeOneOption;
|
merge = mergeEqualOption;
|
||||||
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
|
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user