lib.modules: Define mergeOneOption in terms of mergeUniqueOption

This commit is contained in:
Robert Hensing 2022-01-24 16:23:18 +01:00
parent 4800f30841
commit 8691ab3d47

View File

@ -128,11 +128,7 @@ rec {
else if all isInt list && all (x: x == head list) list then head list
else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}";
mergeOneOption = loc: defs:
if defs == [] then abort "This case should never happen."
else if length defs != 1 then
throw "The unique option `${showOption loc}' is defined multiple times. Definition values:${showDefs defs}"
else (head defs).value;
mergeOneOption = mergeUniqueOption { message = ""; };
mergeUniqueOption = { message }: loc: defs:
if length defs == 1