mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
types: suggest how to resolve the conflict
This commit is contained in:
parent
b3cc29c288
commit
fe734efc9c
1 changed files with 5 additions and 2 deletions
|
@ -36,6 +36,9 @@ let
|
||||||
inherit (lib.types)
|
inherit (lib.types)
|
||||||
mkOptionType
|
mkOptionType
|
||||||
;
|
;
|
||||||
|
prioritySuggestion = ''
|
||||||
|
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
|
@ -184,7 +187,7 @@ rec {
|
||||||
if length defs == 1
|
if length defs == 1
|
||||||
then (head defs).value
|
then (head defs).value
|
||||||
else assert length defs > 1;
|
else assert length defs > 1;
|
||||||
throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}";
|
throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}\n${prioritySuggestion}";
|
||||||
|
|
||||||
/* "Merge" option definitions by checking that they all have the same value. */
|
/* "Merge" option definitions by checking that they all have the same value. */
|
||||||
mergeEqualOption = loc: defs:
|
mergeEqualOption = loc: defs:
|
||||||
|
@ -195,7 +198,7 @@ rec {
|
||||||
else if length defs == 1 then (head defs).value
|
else if length defs == 1 then (head defs).value
|
||||||
else (foldl' (first: def:
|
else (foldl' (first: def:
|
||||||
if def.value != first.value then
|
if def.value != first.value then
|
||||||
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}"
|
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}\n${prioritySuggestion}"
|
||||||
else
|
else
|
||||||
first) (head defs) (tail defs)).value;
|
first) (head defs) (tail defs)).value;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue