make-disk-image: embed compression switch into the format name
This commit is contained in:
parent
608de48fe4
commit
27f5cc959b
@ -33,17 +33,17 @@
|
|||||||
|
|
||||||
, name ? "nixos-disk-image"
|
, name ? "nixos-disk-image"
|
||||||
|
|
||||||
, # Disk image format, one of qcow2, vpc, raw.
|
, # Disk image format, one of qcow2, qcow2-compressed, vpc, raw.
|
||||||
format ? "raw"
|
format ? "raw"
|
||||||
|
|
||||||
, # Whether to compress the image, applicable only when the format is qcow2.
|
|
||||||
compressed ? false
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let format' = format; in let
|
||||||
compress = optionalString compressed (assert format == "qcow2"; "-c");
|
|
||||||
|
format = if (format' == "qcow2-compressed") then "qcow2" else format;
|
||||||
|
|
||||||
|
compress = optionalString (format' == "qcow2-compressed") "-c";
|
||||||
|
|
||||||
filename = "nixos." + {
|
filename = "nixos." + {
|
||||||
qcow2 = "qcow2";
|
qcow2 = "qcow2";
|
||||||
|
Loading…
Reference in New Issue
Block a user