From 5d5fc5f6753f115832a14d2c2bf451ffaeb3378e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 2 Mar 2012 14:01:57 +0000 Subject: [PATCH] =?UTF-8?q?*=20Add=20an=20option=20=E2=80=98deployment.vir?= =?UTF-8?q?tualbox.baseImage=E2=80=99=20to=20specify=20the=20=20=20Virtual?= =?UTF-8?q?Box/Charon=20base=20image.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixos/trunk/; revision=32743 --- modules/misc/deployment.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/modules/misc/deployment.nix b/modules/misc/deployment.nix index 146baec16dd2..836ff1f5733e 100644 --- a/modules/misc/deployment.nix +++ b/modules/misc/deployment.nix @@ -156,6 +156,17 @@ let cfg = config.deployment; in ''; }; + # VirtualBox options. + + deployment.virtualbox.baseImage = mkOption { + example = "/home/alice/base-disk.vdi"; + description = '' + Path to the initial disk image used to bootstrap the + VirtualBox instance. The instance boots from a clone of this + image. + ''; + }; + # Computed options useful for referring to other machines in # network specifications. @@ -198,6 +209,25 @@ let cfg = config.deployment; in ""); }; + + deployment.virtualbox = { + + baseImage = mkDefault ( + let + unpack = name: sha256: pkgs.runCommand "virtualbox-charon-${name}.vdi" {} + '' + xz < ${pkgs.fetchurl { + url = "http://nixos.org/releases/nixos/virtualbox-charon-images/virtualbox-charon-${name}.vdi.xz"; + inherit sha256; + }} > $out + ''; + in if config.nixpkgs.system == "x86_64-linux" then + unpack "r32740-x86_64" "0vwjcf85y4qyd5hxh8gb2nnkhbpdz2j284w5d7x94rvczfpa49hz" + else if config.nixpkgs.system == "i686-linux" then /foo/disk.vdi else + throw "Unsupported VirtualBox system type!" + ); + + }; };