From 1dfab1d7ea5da1825c359e50f42b323e6ac49d22 Mon Sep 17 00:00:00 2001
From: Rob Vermaas <rob.vermaas@gmail.com>
Date: Mon, 14 Dec 2009 11:15:37 +0000
Subject: [PATCH] * virtualisation.memorySize option to set memory size of
 virtual machine

svn path=/nixos/trunk/; revision=18933
---
 modules/virtualisation/qemu-vm.nix | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix
index 68ba340e6c2..5d4d458de46 100644
--- a/modules/virtualisation/qemu-vm.nix
+++ b/modules/virtualisation/qemu-vm.nix
@@ -16,7 +16,14 @@ let
   vmName = config.networking.hostName;
 
   options = {
-
+    virtualisation.memorySize = 
+      mkOption {
+        default = 384;
+        description =
+          ''
+            Memory size (M) of virtual machine.
+          '';
+      };
     virtualisation.diskImage =
       mkOption {
         default = "./${vmName}.qcow2";
@@ -46,7 +53,7 @@ let
       
       # -no-kvm-irqchip is needed to prevent the CIFS mount from
       # hanging the VM on x86_64.
-      exec ${pkgs.qemu_kvm}/bin/qemu-system-x86_64 -m 384 \
+      exec ${pkgs.qemu_kvm}/bin/qemu-system-x86_64 -m ${toString config.virtualisation.memorySize} \
           -no-kvm-irqchip \
           -net nic,model=virtio -net user -smb / \
           -drive file=$NIX_DISK_IMAGE,if=virtio,boot=on \