amazon-image: make image size configurable

This commit is contained in:
Dan Peebles 2017-08-11 01:57:38 +00:00
parent f40f4f5440
commit 5def5bab3c

View File

@ -23,6 +23,12 @@ in {
''; '';
}; };
sizeMB = mkOption {
type = types.int;
default = if config.ec2.hvm then 2048 else 8192;
description = "The size in MB of the image";
};
format = mkOption { format = mkOption {
type = types.enum [ "raw" "qcow2" "vpc" ]; type = types.enum [ "raw" "qcow2" "vpc" ];
default = "qcow2"; default = "qcow2";
@ -35,7 +41,7 @@ in {
inherit (cfg) contents format; inherit (cfg) contents format;
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
partitioned = config.ec2.hvm; partitioned = config.ec2.hvm;
diskSize = if config.ec2.hvm then 2048 else 8192; diskSize = sizeMB;
configFile = pkgs.writeText "configuration.nix" configFile = pkgs.writeText "configuration.nix"
'' ''
{ {
@ -46,5 +52,4 @@ in {
} }
''; '';
}; };
} }