nixos/virtualbox-image: add params
This commit is contained in:
parent
0bffd2150e
commit
be255392dd
|
@ -45,10 +45,41 @@ in {
|
||||||
The file name of the VirtualBox appliance.
|
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 = {
|
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 {
|
system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
|
||||||
name = cfg.vmDerivationName;
|
name = cfg.vmDerivationName;
|
||||||
|
|
||||||
|
@ -69,12 +100,8 @@ in {
|
||||||
VBoxManage createvm --name "$vmName" --register \
|
VBoxManage createvm --name "$vmName" --register \
|
||||||
--ostype ${if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
|
--ostype ${if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
|
||||||
VBoxManage modifyvm "$vmName" \
|
VBoxManage modifyvm "$vmName" \
|
||||||
--memory ${toString cfg.memorySize} --acpi on --vram 32 \
|
--memory ${toString cfg.memorySize} \
|
||||||
${optionalString (pkgs.stdenv.hostPlatform.system == "i686-linux") "--pae on"} \
|
${lib.cli.toGNUCommandLineShell { } cfg.params}
|
||||||
--nictype1 virtio --nic1 nat \
|
|
||||||
--audiocontroller ac97 --audio alsa --audioout on \
|
|
||||||
--rtcuseutc on \
|
|
||||||
--usb on --usbehci 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.vmdk
|
--medium disk.vmdk
|
||||||
|
|
Loading…
Reference in New Issue
Block a user