Author: eelco
Date: Sat Feb 25 21:36:00 2012
New Revision: 32570
URL: https://nixos.org/websvn/nix/?rev=32570&sc=1

Log:
* Module for building a VirtualBox disk image (.vdi).  TODO: merge
  this with the Amazon and Nova image builders.

Added:
   nixos/trunk/modules/virtualisation/virtualbox-image.nix
      - copied, changed from r32523, 
nixos/trunk/modules/virtualisation/nova-image.nix

Copied and modified: nixos/trunk/modules/virtualisation/virtualbox-image.nix 
(from r32523, nixos/trunk/modules/virtualisation/nova-image.nix)
==============================================================================
--- nixos/trunk/modules/virtualisation/nova-image.nix   Thu Feb 23 21:14:19 
2012        (r32523, copy source)
+++ nixos/trunk/modules/virtualisation/virtualbox-image.nix     Sat Feb 25 
21:36:00 2012        (r32570)
@@ -3,11 +3,9 @@
 with pkgs.lib;
 
 {
-  require = [ ../profiles/qemu-guest.nix ../profiles/headless.nix 
./ec2-data.nix ];
-
-  system.build.novaImage =
+  system.build.virtualBoxImage =
     pkgs.vmTools.runInLinuxVM (
-      pkgs.runCommand "nova-image"
+      pkgs.runCommand "virtualbox-image"
         { preVM =
             ''
               mkdir $out
@@ -15,6 +13,11 @@
               ${pkgs.vmTools.kvm}/bin/qemu-img create -f raw $diskImage "4G"
               mv closure xchg/
             '';
+          postVM =
+            ''
+              ${pkgs.vmTools.kvm}/bin/qemu-img convert -f raw -O vdi 
$diskImage $out/disk.vdi
+              rm $diskImage
+            '';
           buildInputs = [ pkgs.utillinux pkgs.perl ];
           exportReferencesGraph =
             [ "closure" config.system.build.toplevel ];
@@ -74,43 +77,8 @@
       }
     ];
 
-  boot.kernelParams = [ "console=ttyS0" ];
-
-  boot.initrd.kernelModules = [ "aufs" ];
-
-  boot.extraModulePackages = [ config.boot.kernelPackages.aufs ];
-
   boot.loader.grub.version = 2;
   boot.loader.grub.device = "/dev/vda";
-  boot.loader.grub.timeout = 0;
 
-  # Put /tmp and /var on /ephemeral0, which has a lot more space.
-  # Unfortunately we can't do this with the `fileSystems' option
-  # because it has no support for creating the source of a bind
-  # mount.  Also, "move" /nix to /ephemeral0 by layering an AUFS
-  # on top of it so we have a lot more space for Nix operations.
-  /*
-  boot.initrd.postMountCommands =
-    ''
-      mkdir -m 1777 -p $targetRoot/ephemeral0/tmp
-      mkdir -m 1777 -p $targetRoot/tmp
-      mount --bind $targetRoot/ephemeral0/tmp $targetRoot/tmp
-
-      mkdir -m 755 -p $targetRoot/ephemeral0/var
-      mkdir -m 755 -p $targetRoot/var
-      mount --bind $targetRoot/ephemeral0/var $targetRoot/var
-
-      mkdir -m 755 -p $targetRoot/ephemeral0/nix
-      mount -t aufs -o dirs=$targetRoot/ephemeral0/nix=rw:$targetRoot/nix=rr 
none $targetRoot/nix
-    '';
-    */
-
-  # Since Nova allows VNC access to instances, it's nice to start to
-  # start a few virtual consoles.
-  services.mingetty.ttys = [ "tty1" "tty2" ];
-
-  # Allow root logins only using the SSH key that the user specified
-  # at instance creation time.
-  services.openssh.enable = true;
-  services.openssh.permitRootLogin = "without-password";
+  services.virtualbox.enable = true;
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to