summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-03-05 17:21:57 +0300
committerNikolay Amiantov <ab@fmap.me>2016-07-19 05:20:02 +0300
commit399db54e3514ceaee82ec217140975d77963359f (patch)
tree8bf26837eccb8988fa6b76341ada2b0df8bdf09b /nixos
parent28740462e7c03b607e5ea06c3acf5a2da772fb01 (diff)
downloadnixlib-399db54e3514ceaee82ec217140975d77963359f.tar
nixlib-399db54e3514ceaee82ec217140975d77963359f.tar.gz
nixlib-399db54e3514ceaee82ec217140975d77963359f.tar.bz2
nixlib-399db54e3514ceaee82ec217140975d77963359f.tar.lz
nixlib-399db54e3514ceaee82ec217140975d77963359f.tar.xz
nixlib-399db54e3514ceaee82ec217140975d77963359f.tar.zst
nixlib-399db54e3514ceaee82ec217140975d77963359f.zip
nixos/qemu: don't recreate extra disks
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix4
1 files changed, 3 insertions, 1 deletions
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))
       '')}