mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 21:49:34 +03:00
virtualbox-image: use vmdk wrapper instead of vdi copy (avoids 1 disk copy)
This commit is contained in:
parent
58db7f508f
commit
80660f8261
1 changed files with 6 additions and 6 deletions
|
@ -31,13 +31,13 @@ in {
|
||||||
|
|
||||||
postVM =
|
postVM =
|
||||||
''
|
''
|
||||||
echo "creating VirtualBox disk image..."
|
|
||||||
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage disk.vdi
|
|
||||||
rm $diskImage
|
|
||||||
|
|
||||||
echo "creating VirtualBox VM..."
|
|
||||||
export HOME=$PWD
|
export HOME=$PWD
|
||||||
export PATH=${pkgs.linuxPackages.virtualbox}/bin:$PATH
|
export PATH=${pkgs.linuxPackages.virtualbox}/bin:$PATH
|
||||||
|
|
||||||
|
echo "creating VirtualBox pass-through disk wrapper (no copying invovled)..."
|
||||||
|
VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk $diskImage
|
||||||
|
|
||||||
|
echo "creating VirtualBox VM..."
|
||||||
vmName="NixOS ${config.system.nixosLabel} (${pkgs.stdenv.system})"
|
vmName="NixOS ${config.system.nixosLabel} (${pkgs.stdenv.system})"
|
||||||
VBoxManage createvm --name "$vmName" --register \
|
VBoxManage createvm --name "$vmName" --register \
|
||||||
--ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
|
--ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
|
||||||
|
@ -50,7 +50,7 @@ in {
|
||||||
--usb on --mouse usbtablet
|
--usb on --mouse usbtablet
|
||||||
VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
|
VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
|
||||||
VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
|
VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
|
||||||
--medium disk.vdi
|
--medium disk.vmdk
|
||||||
|
|
||||||
echo "exporting VirtualBox VM..."
|
echo "exporting VirtualBox VM..."
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue