Merge branch 'vbox-configurable-imgsize' of git://github.com/rickynils/nixpkgs

This commit is contained in:
Shea Levy 2014-08-04 13:20:13 -04:00
commit 8a35a474fe
1 changed files with 124 additions and 104 deletions

View File

@ -2,7 +2,26 @@
with lib; with lib;
{ let
cfg = config.virtualbox;
in {
options = {
virtualbox = {
baseImageSize = mkOption {
type = types.str;
default = 10G;
description = ''
The size of the VirtualBox base image. The size string should be on
a format the qemu-img command accepts.
'';
};
};
};
config = {
system.build.virtualBoxImage = system.build.virtualBoxImage =
pkgs.vmTools.runInLinuxVM ( pkgs.vmTools.runInLinuxVM (
pkgs.runCommand "virtualbox-image" pkgs.runCommand "virtualbox-image"
@ -11,7 +30,7 @@ with lib;
'' ''
mkdir $out mkdir $out
diskImage=$out/image diskImage=$out/image
${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "10G" ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "${cfg.baseImageSize}"
mv closure xchg/ mv closure xchg/
''; '';
postVM = postVM =
@ -110,4 +129,5 @@ with lib;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
services.virtualbox.enable = true; services.virtualbox.enable = true;
};
} }