anchor.diff:      boot.kernelModules = [ "xen-netfront" ];
   
       # Generate a GRUB menu.  Amazon's pv-grub uses this to boot our kernel/initrd.
  -    boot.loader.grub.version = 1;
  +    boot.loader.grub.version = if cfg.hvm then 2 else 1;
       boot.loader.grub.device = if cfg.hvm then "/dev/xvda" else "nodev";
       boot.loader.grub.timeout = 0;
       boot.loader.grub.extraPerEntryConfig = "root (hd0${lib.optionalString cfg.hvm ",0"})";
  
positive.code:               [ "closure" config.system.build.toplevel ];
            }
            ''
              # Create an empty filesystem and mount it.
              ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda
              ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda
              mkdir /mnt
              mount /dev/vda /mnt
  
              # The initrd expects these directories to exist.
              mkdir /mnt/dev /mnt/proc /mnt/sys
  
              mount -o bind /proc /mnt/proc
  
              # Copy all paths in the closure to the filesystem.
              storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
  
negative.code:             cp ${./amazon-config.nix} /mnt/etc/nixos/configuration.nix
  
              # Generate the GRUB menu.
              ln -s vda /dev/xvda
              chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
  
              umount /mnt/proc /mnt/dev /mnt/sys
              umount /mnt
            ''
        );
  