@@ -17,12 +17,40 @@ in {
1717 The size of the VirtualBox base image in MiB.
1818 '';
1919 };
20+ memorySize = mkOption {
21+ type = types.int;
22+ default = 1536;
23+ description = ''
24+ The amount of RAM the VirtualBox appliance can use in MiB.
25+ '';
26+ };
27+ vmDerivationName = mkOption {
28+ type = types.str;
29+ default = "nixos-ova-${config.system.nixos.label}-${pkgs.stdenv.system}";
30+ description = ''
31+ The name of the derivation for the VirtualBox appliance.
32+ '';
33+ };
34+ vmName = mkOption {
35+ type = types.str;
36+ default = "NixOS ${config.system.nixos.label} (${pkgs.stdenv.system})";
37+ description = ''
38+ The name of the VirtualBox appliance.
39+ '';
40+ };
41+ vmFileName = mkOption {
42+ type = types.str;
43+ default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.system}.ova";
44+ description = ''
45+ The file name of the VirtualBox appliance.
46+ '';
47+ };
2048 };
2149 };
2250
2351 config = {
2452 system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
25− name = "nixos-ova-${config.system.nixos.label}-${pkgs.stdenv.system}";
53+ name = cfg.vmDerivationName;
2654
2755 inherit pkgs lib config;
2856 partitionTableType = "legacy";
@@ -37,11 +65,11 @@ in {
3765 VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk $diskImage
3866
3967 echo "creating VirtualBox VM..."
40− vmName="NixOS ${config.system.nixos.label} (${pkgs.stdenv.system})"
68+ vmName="${cfg.vmName}";
4169 VBoxManage createvm --name "$vmName" --register \
4270 --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
4371 VBoxManage modifyvm "$vmName" \
44− --memory 1536 --acpi on --vram 32 \
72+ --memory ${toString cfg.memorySize} --acpi on --vram 32 \
4573 ${optionalString (pkgs.stdenv.system == "i686-linux") "--pae on"} \
4674 --nictype1 virtio --nic1 nat \
4775 --audiocontroller ac97 --audio alsa \
@@ -53,7 +81,7 @@ in {
5381
5482 echo "exporting VirtualBox VM..."
5583 mkdir -p $out
56− fn="$out/nixos-${config.system.nixos.label}-${pkgs.stdenv.system}.ova"
84+ fn="$out/${cfg.vmFileName}"
5785 VBoxManage export "$vmName" --output "$fn"
5886
5987 rm -v $diskImage