0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

lib/options.nix: Use head instead of elemAt _ 0

This commit is contained in:
Robert Hensing 2020-10-22 13:41:28 +02:00
parent 002750572a
commit 4d4682c2b6

View file

@ -110,7 +110,7 @@ rec {
# Return early if we only have one element
# This also makes it work for functions, because the foldl' below would try
# to compare the first element with itself, which is false for functions
else if length defs == 1 then (elemAt defs 0).value
else if length defs == 1 then (head defs).value
else (foldl' (first: def:
if def.value != first.value then
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}"