Allocate virtualisation.diskSize with useBootLoader
This commit is contained in:
@@ -136,14 +136,20 @@ let
|
|||||||
''
|
''
|
||||||
# Create a writable qcow2 image using the systemImage as a backing
|
# Create a writable qcow2 image using the systemImage as a backing
|
||||||
# image.
|
# image.
|
||||||
|
BACKING_SIZE_MB=$(( $(${lib.getExe' qemu "qemu-img"} info ${systemImage}/nixos.qcow2 --output=json | ${lib.getExe hostPkgs.jq} -r '."virtual-size"') / 1024 / 1024 ))
|
||||||
|
DISK_SIZE_MB=${toString cfg.diskSize}
|
||||||
|
if (( DISK_SIZE_MB < BACKING_SIZE_MB )); then
|
||||||
|
OVERLAY_SIZE_MB=$BACKING_SIZE_MB
|
||||||
|
else
|
||||||
|
OVERLAY_SIZE_MB=$DISK_SIZE_MB
|
||||||
|
fi
|
||||||
|
|
||||||
# CoW prevent size to be attributed to an image.
|
|
||||||
# FIXME: raise this issue to upstream.
|
|
||||||
${qemu}/bin/qemu-img create \
|
${qemu}/bin/qemu-img create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b ${systemImage}/nixos.qcow2 \
|
-b ${systemImage}/nixos.qcow2 \
|
||||||
-F qcow2 \
|
-F qcow2 \
|
||||||
"$NIX_DISK_IMAGE"
|
"$NIX_DISK_IMAGE" \
|
||||||
|
''${OVERLAY_SIZE_MB}M
|
||||||
''
|
''
|
||||||
else if cfg.useDefaultFilesystems then
|
else if cfg.useDefaultFilesystems then
|
||||||
''
|
''
|
||||||
|
|||||||
Reference in New Issue
Block a user