Merge branch 'vbox-configurable-imgsize' of git://github.com/rickynils/nixpkgs
This commit is contained in:
commit
8a35a474fe
@ -2,7 +2,26 @@
|
||||
|
||||
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 =
|
||||
pkgs.vmTools.runInLinuxVM (
|
||||
pkgs.runCommand "virtualbox-image"
|
||||
@ -11,7 +30,7 @@ with lib;
|
||||
''
|
||||
mkdir $out
|
||||
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/
|
||||
'';
|
||||
postVM =
|
||||
@ -110,4 +129,5 @@ with lib;
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
|
||||
services.virtualbox.enable = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user