From 399db54e3514ceaee82ec217140975d77963359f Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 5 Mar 2015 17:21:57 +0300 Subject: [PATCH] nixos/qemu: don't recreate extra disks --- nixos/modules/virtualisation/qemu-vm.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 9d9b725a805d..b77b319f4a28 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -62,7 +62,9 @@ let idx=2 extraDisks="" ${flip concatMapStrings cfg.emptyDiskImages (size: '' - ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M" + if ! test -e "empty$idx.qcow2"; then + ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M" + fi extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=${cfg.qemu.diskInterface},werror=report" idx=$((idx + 1)) '')}