Skip to content

Commit 27cfd3a

Browse files
committed
cloud-hypervisor: don't use null ops
1 parent 0cb5add commit 27cfd3a

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

lib/runners/cloud-hypervisor.nix

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ let
2727

2828
# Transform attrs to parameters in form of `key1=value1,key2=value2,[...]`
2929
opsMapped = ops: lib.concatStringsSep "," (
30-
lib.mapAttrsToList
31-
(k: v: "${k}=${v}")
32-
(lib.attrsets.filterAttrs (_: v: v != null) ops)
30+
lib.mapAttrsToList (k: v:
31+
"${k}=${v}"
32+
) ops
3333
);
3434

3535
# Attrs representing CHV mem options
@@ -163,14 +163,21 @@ in {
163163
readonly = "on";
164164
} // mqOps))
165165
++
166-
map ({ image, serial, direct, ... }: (opsMapped (({
167-
inherit serial;
168-
path = toString image;
169-
direct =
170-
if direct == null then null
171-
else if direct then "on"
172-
else "off";
173-
}) // mqOps))) volumes
166+
map ({ image, serial, direct, ... }:
167+
opsMapped (
168+
{
169+
path = toString image;
170+
direct =
171+
if direct == null then null
172+
else if direct then "on"
173+
else "off";
174+
} //
175+
lib.optionalAttrs (serial != null) {
176+
inherit serial;
177+
} //
178+
mqOps
179+
)
180+
) volumes
174181
)
175182
++
176183
arg "--fs" (map ({ proto, socket, tag, ... }:

0 commit comments

Comments
 (0)