From 640dff2918c7b3636226a9eb97bb76b6236124e3 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 28 Sep 2015 13:34:19 +0200
Subject: [PATCH] Fix GRUB syntax in EC2 HVM images

There is no "root" command in GRUB 2, and it's not needed anyway. This
command delayed HVM boots for a few seconds.
---
 nixos/modules/virtualisation/amazon-image.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index dd81c424a91a..165109f20b50 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -32,7 +32,7 @@ let cfg = config.ec2; in
     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"})";
+    boot.loader.grub.extraPerEntryConfig = mkIf (!cfg.hvm) "root (hd0)";
 
     boot.initrd.postDeviceCommands =
       ''