summary refs log tree commit diff
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-03-04 12:45:38 +0300
committerK900 <me@0upti.me>2023-03-04 13:39:50 +0300
commite8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040 (patch)
treee29c83e5fc590e596f46ca09bd42542156b74a64
parent9692e965c64ab57aabb90285028e3e2e73430f9f (diff)
downloadnixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar.gz
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar.bz2
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar.lz
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar.xz
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.tar.zst
nixpkgs-e8fbf83f5e697a3d1fe1ca2fb8b74ba75dabc040.zip
nixos/virtualbox-image: remove the raw image trick
This is slower, but the raw image thing no longer works with VirtualBox 7.0.6.
-rw-r--r--nixos/modules/virtualisation/virtualbox-image.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index bb42e6de069..0da217fd1cb 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -81,7 +81,7 @@ in {
       extraDisk = mkOption {
         description = lib.mdDoc ''
           Optional extra disk/hdd configuration.
-          The disk will be an 'ext4' partition on a separate VMDK file.
+          The disk will be an 'ext4' partition on a separate file.
         '';
         default = null;
         example = {
@@ -183,8 +183,8 @@ in {
           export HOME=$PWD
           export PATH=${pkgs.virtualbox}/bin:$PATH
 
-          echo "creating VirtualBox pass-through disk wrapper (no copying involved)..."
-          VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk $diskImage
+          echo "converting image to VirtualBox format..."
+          VBoxManage convertfromraw $diskImage disk.vdi
 
           ${optionalString (cfg.extraDisk != null) ''
             echo "creating extra disk: data-disk.raw"
@@ -196,8 +196,8 @@ in {
               mkpart primary ext4 1MiB -1
             eval $(partx $dataDiskImage -o START,SECTORS --nr 1 --pairs)
             mkfs.ext4 -F -L ${cfg.extraDisk.label} $dataDiskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K
-            echo "creating extra disk: data-disk.vmdk"
-            VBoxManage internalcommands createrawvmdk -filename data-disk.vmdk -rawdisk $dataDiskImage
+            echo "creating extra disk: data-disk.vdi"
+            VBoxManage convertfromraw $dataDiskImage data-disk.vdi
           ''}
 
           echo "creating VirtualBox VM..."
@@ -209,10 +209,10 @@ in {
             ${lib.cli.toGNUCommandLineShell { } cfg.params}
           VBoxManage storagectl "$vmName" ${lib.cli.toGNUCommandLineShell { } cfg.storageController}
           VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 0 --device 0 --type hdd \
-            --medium disk.vmdk
+            --medium disk.vdi
           ${optionalString (cfg.extraDisk != null) ''
             VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 1 --device 0 --type hdd \
-            --medium data-disk.vmdk
+            --medium data-disk.vdi
           ''}
 
           echo "exporting VirtualBox VM..."