aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/virtualisation/virtualbox-image.nix
diff options
context:
space:
mode:
authorMarek Mahut <marek.mahut@gmail.com>2020-02-21 01:02:47 +0100
committerMarek Mahut <marek.mahut@gmail.com>2020-02-21 16:53:32 +0100
commitbe255392dd85e8d649aa2b278b5a5227de1543d4 (patch)
tree15dba73f3a3b1c92b59650ae8c7f5db3aaf49a32 /nixos/modules/virtualisation/virtualbox-image.nix
parent0bffd2150e5bbd9671bf98817a72e87ae41bc0ed (diff)
nixos/virtualbox-image: add params
Diffstat (limited to 'nixos/modules/virtualisation/virtualbox-image.nix')
-rw-r--r--nixos/modules/virtualisation/virtualbox-image.nix39
1 files changed, 33 insertions, 6 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index ab65523592d7..788b4d9d9761 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -45,10 +45,41 @@ in {
The file name of the VirtualBox appliance.
'';
};
+ params = mkOption {
+ type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
+ example = {
+ audio = "alsa";
+ rtcuseutc = "on";
+ usb = "off";
+ };
+ description = ''
+ Parameters passed to the Virtualbox appliance.
+
+ Run <literal>VBoxManage modifyvm --help</literal> to see more options.
+ '';
+ };
};
};
config = {
+
+ virtualbox.params = mkMerge [
+ (mapAttrs (name: mkDefault) {
+ acpi = "on";
+ vram = 32;
+ nictype1 = "virtio";
+ nic1 = "nat";
+ audiocontroller = "ac97";
+ audio = "alsa";
+ audioout = "on";
+ rtcuseutc = "on";
+ usb = "on";
+ usbehci = "on";
+ mouse = "usbtablet";
+ })
+ (mkIf (pkgs.stdenv.hostPlatform.system == "i686-linux") { pae = "on"; })
+ ];
+
system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
name = cfg.vmDerivationName;
@@ -69,12 +100,8 @@ in {
VBoxManage createvm --name "$vmName" --register \
--ostype ${if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
VBoxManage modifyvm "$vmName" \
- --memory ${toString cfg.memorySize} --acpi on --vram 32 \
- ${optionalString (pkgs.stdenv.hostPlatform.system == "i686-linux") "--pae on"} \
- --nictype1 virtio --nic1 nat \
- --audiocontroller ac97 --audio alsa --audioout on \
- --rtcuseutc on \
- --usb on --usbehci on --mouse usbtablet
+ --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 \
--medium disk.vmdk