vmTools.createEmptyImage: Add destination parameter

This commit is contained in:
Robert Hensing 2021-09-29 09:33:14 +02:00
parent fa0cc611ff
commit 8863a5199d

View File

@ -257,14 +257,23 @@ rec {
eval "$postVM"
'';
createEmptyImage = {size, fullName}: ''
mkdir $out
diskImage=$out/disk-image.qcow2
/*
A bash script fragment that produces a disk image at `destination`.
*/
createEmptyImage = {
# Disk image size in MiB
size,
# Name that will be written to ${destination}/nix-support/full-name
fullName,
# Where to write the image files, defaulting to $out
destination ? "$out"
}: ''
mkdir -p ${destination}
diskImage=${destination}/disk-image.qcow2
${qemu}/bin/qemu-img create -f qcow2 $diskImage "${toString size}M"
mkdir $out/nix-support
echo "${fullName}" > $out/nix-support/full-name
mkdir ${destination}/nix-support
echo "${fullName}" > ${destination}/nix-support/full-name
'';