about summary refs log tree commit diff
path: root/nixos/tests/ec2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/ec2.nix')
-rw-r--r--nixos/tests/ec2.nix19
1 files changed, 13 insertions, 6 deletions
diff --git a/nixos/tests/ec2.nix b/nixos/tests/ec2.nix
index 0a95d6cfeff4..e1f7143e3a95 100644
--- a/nixos/tests/ec2.nix
+++ b/nixos/tests/ec2.nix
@@ -11,7 +11,6 @@ let
       modules = [
         ../maintainers/scripts/ec2/amazon-image.nix
         ../modules/testing/test-instrumentation.nix
-        ../modules/profiles/minimal.nix
         ../modules/profiles/qemu-guest.nix
         { ec2.hvm = true;
 
@@ -21,6 +20,14 @@ let
               ln -s vda /dev/xvda
               ln -s vda1 /dev/xvda1
             '';
+
+          # Needed by nixos-rebuild due to the lack of network
+          # access. Mostly copied from
+          # modules/profiles/installation-device.nix.
+          system.extraDependencies =
+            [ pkgs.stdenv pkgs.busybox pkgs.perlPackages.ArchiveCpio
+              pkgs.unionfs-fuse pkgs.mkinitcpio-nfs-utils
+            ];
         }
       ];
     }).config.system.build.amazonImage;
@@ -30,9 +37,8 @@ let
       metaData = pkgs.stdenv.mkDerivation {
         name = "metadata";
         buildCommand = ''
-          mkdir -p $out/2011-01-01
-          ln -s ${pkgs.writeText "userData" userData} $out/2011-01-01/user-data
           mkdir -p $out/1.0/meta-data
+          ln -s ${pkgs.writeText "userData" userData} $out/1.0/user-data
           echo "${hostname}" > $out/1.0/meta-data/hostname
           echo "(unknown)" > $out/1.0/meta-data/ami-manifest-path
         '' + optionalString (sshPublicKey != null) ''
@@ -48,7 +54,7 @@ let
           my $imageDir = ($ENV{'TMPDIR'} // "/tmp") . "/vm-state-machine";
           mkdir $imageDir, 0700;
           my $diskImage = "$imageDir/machine.qcow2";
-          system("qemu-img create -f qcow2 -o backing_file=${image}/nixos.img $diskImage") == 0 or die;
+          system("qemu-img create -f qcow2 -o backing_file=${image}/nixos.qcow2 $diskImage") == 0 or die;
           system("qemu-img resize $diskImage 10G") == 0 or die;
 
           # Note: we use net=169.0.0.0/8 rather than
@@ -91,7 +97,7 @@ in {
     '';
     script = ''
       $machine->start;
-      $machine->waitForFile("/root/user-data");
+      $machine->waitForFile("/etc/ec2-metadata/user-data");
       $machine->waitForUnit("sshd.service");
 
       $machine->succeed("grep unknown /etc/ec2-metadata/ami-manifest-path");
@@ -121,7 +127,7 @@ in {
       # Just to make sure resizing is idempotent.
       $machine->shutdown;
       $machine->start;
-      $machine->waitForFile("/root/user-data");
+      $machine->waitForFile("/etc/ec2-metadata/user-data");
     '';
   };
 
@@ -135,6 +141,7 @@ in {
         imports = [
           <nixpkgs/nixos/modules/virtualisation/amazon-image.nix>
           <nixpkgs/nixos/modules/testing/test-instrumentation.nix>
+          <nixpkgs/nixos/modules/profiles/qemu-guest.nix>
         ];
         environment.etc.testFile = {
           text = "whoa";