From 27f5cc959bd3beb93352f65c0ce0d4f7aa4f63f8 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sun, 12 Nov 2017 18:29:01 +0000 Subject: [PATCH] make-disk-image: embed compression switch into the format name --- nixos/lib/make-disk-image.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix index c2a5415d1b2a..226817cf6a7f 100644 --- a/nixos/lib/make-disk-image.nix +++ b/nixos/lib/make-disk-image.nix @@ -33,17 +33,17 @@ , name ? "nixos-disk-image" -, # Disk image format, one of qcow2, vpc, raw. +, # Disk image format, one of qcow2, qcow2-compressed, vpc, raw. format ? "raw" - -, # Whether to compress the image, applicable only when the format is qcow2. - compressed ? false }: with lib; -let - compress = optionalString compressed (assert format == "qcow2"; "-c"); +let format' = format; in let + + format = if (format' == "qcow2-compressed") then "qcow2" else format; + + compress = optionalString (format' == "qcow2-compressed") "-c"; filename = "nixos." + { qcow2 = "qcow2";