summary refs log tree commit diff
path: root/nixos/modules/virtualisation/virtualbox-image.nix
diff options
context:
space:
mode:
authorRobert Kovacsics <robert.kovacsics@cambridgeconsultants.com>2022-10-13 18:01:08 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2023-02-04 07:33:11 +0100
commit32ec41a6726d57e539acea7ac57f94266d8d8d1a (patch)
tree47e5a00122064a6d934c82cf88843173b2721413 /nixos/modules/virtualisation/virtualbox-image.nix
parent4009f60d0ba7efec0200b1d5f7311693c008c172 (diff)
downloadnixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar.gz
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar.bz2
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar.lz
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar.xz
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.tar.zst
nixpkgs-32ec41a6726d57e539acea7ac57f94266d8d8d1a.zip
nixos/virtualbox-image: Allow SCSI storage controller for vSphere
This is because vSphere version 6.7.0.51000 errors with

        Issues detected with selected template. Details: -
        78:7:VALUE_ILLEGAL: Value ''3'' of Parent element does not refer
        to a ref of type DiskControllerReference.

when using SATA.
Diffstat (limited to 'nixos/modules/virtualisation/virtualbox-image.nix')
-rw-r--r--nixos/modules/virtualisation/virtualbox-image.nix29
1 files changed, 26 insertions, 3 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index 407d690e32e..bb42e6de069 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -124,6 +124,29 @@ in {
           Extra commands to run after exporting the OVA to `$fn`.
         '';
       };
+      storageController = mkOption {
+        type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
+        example = {
+          name = "SCSI";
+          add = "scsi";
+          portcount = 16;
+          bootable = "on";
+          hostiocache = "on";
+        };
+        default = {
+          name = "SATA";
+          add = "sata";
+          portcount = 4;
+          bootable = "on";
+          hostiocache = "on";
+        };
+        description = lib.mdDoc ''
+          Parameters passed to the VirtualBox appliance. Must have at least
+          `name`.
+
+          Run `VBoxManage storagectl --help` to see more options.
+        '';
+      };
     };
   };
 
@@ -184,11 +207,11 @@ in {
           VBoxManage modifyvm "$vmName" \
             --memory ${toString cfg.memorySize} \
             ${lib.cli.toGNUCommandLineShell { } cfg.params}
-          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 storagectl "$vmName" ${lib.cli.toGNUCommandLineShell { } cfg.storageController}
+          VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 0 --device 0 --type hdd \
             --medium disk.vmdk
           ${optionalString (cfg.extraDisk != null) ''
-            VBoxManage storageattach "$vmName" --storagectl SATA --port 1 --device 0 --type hdd \
+            VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 1 --device 0 --type hdd \
             --medium data-disk.vmdk
           ''}