From 35dbcbb2960cd5a310638183cf75a7874c57e373 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 4 Apr 2017 13:07:15 +0200 Subject: [PATCH] Fix eval error due to config.ec2.hvm --- nixos/modules/virtualisation/amazon-image.nix | 6 ++++++ nixos/modules/virtualisation/amazon-options.nix | 10 +--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix index 80e481d79b9e..3e47710361a8 100644 --- a/nixos/modules/virtualisation/amazon-image.nix +++ b/nixos/modules/virtualisation/amazon-image.nix @@ -15,6 +15,12 @@ let cfg = config.ec2; in config = { + assertions = [ + { assertion = cfg.hvm; + message = "Paravirtualized EC2 instances are no longer supported."; + } + ]; + virtualisation.growPartition = cfg.hvm; fileSystems."/" = { diff --git a/nixos/modules/virtualisation/amazon-options.nix b/nixos/modules/virtualisation/amazon-options.nix index cba77d3edd1d..349fd3adfc96 100644 --- a/nixos/modules/virtualisation/amazon-options.nix +++ b/nixos/modules/virtualisation/amazon-options.nix @@ -3,7 +3,7 @@ options = { ec2 = { hvm = lib.mkOption { - default = false; + default = lib.versionAtLeast config.system.stateVersion "17.03"; internal = true; description = '' Whether the EC2 instance is a HVM instance. @@ -11,12 +11,4 @@ }; }; }; - - config = { - assertions = [ - { assertion = config.ec2.hvm; - message = "Paravirtualized EC2 instances are no longer supported."; - } - ]; - }; }