From e1ae8a8194f6aa153286aee24fb1d3ddd25662f5 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Tue, 26 May 2026 13:38:25 -0400 Subject: [PATCH] lib.gvariant.mkArray: refactor --- lib/gvariant.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gvariant.nix b/lib/gvariant.nix index 810e0db799bd..d47d5120ef9a 100644 --- a/lib/gvariant.nix +++ b/lib/gvariant.nix @@ -194,11 +194,12 @@ rec { vs = map mkValue ( if elems == [ ] then throw "Please create empty array with mkEmptyArray." else elems ); + firstType = (head vs).type; elemType = - if lib.any (t: (head vs).type != t) (map (v: v.type) vs) then + if lib.any (v: v.type != firstType) vs then throw "Elements in a list should have same type." else - (head vs).type; + firstType; in mkPrimitive (type.arrayOf elemType) vs // {