mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
lib.gvariant: fix rendering of empty non-string arrays
Before, empty arrays would always be rendered as an empty string array.
This commit is contained in:
parent
a3d691c053
commit
a965b097b1
3 changed files with 18 additions and 7 deletions
|
|
@ -70,7 +70,11 @@ in rec {
|
|||
check = v: gvar.mkValue v != null;
|
||||
merge = loc: defs:
|
||||
let
|
||||
vdefs = map (d: d // { value = gvar.mkValue d.value; }) defs;
|
||||
vdefs = map (d:
|
||||
d // {
|
||||
value =
|
||||
if gvar.isGVariant d.value then d.value else gvar.mkValue d.value;
|
||||
}) defs;
|
||||
vals = map (d: d.value) vdefs;
|
||||
defTypes = map (x: x.type) vals;
|
||||
sameOrNull = x: y: if x == y then y else null;
|
||||
|
|
@ -82,8 +86,10 @@ in rec {
|
|||
+ " mismatched GVariant types given in"
|
||||
+ " ${showFiles (getFiles defs)}.")
|
||||
else if gvar.isArray sharedDefType && allChecked then
|
||||
(types.listOf gvariant).merge loc
|
||||
(map (d: d // { value = d.value.value; }) vdefs)
|
||||
gvar.mkValue ((types.listOf gvariant).merge loc
|
||||
(map (d: d // { value = d.value.value; }) vdefs)) // {
|
||||
type = sharedDefType;
|
||||
}
|
||||
else if gvar.isTuple sharedDefType && allChecked then
|
||||
mergeOneOption loc defs
|
||||
else if gvar.isMaybe sharedDefType && allChecked then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue