amazon-image: sizeMB -> virtualisation.diskSize
This commit is contained in:
parent
d223461d54
commit
759de4c54d
@ -15,11 +15,26 @@ let
|
||||
inherit (lib.options) literalExpression;
|
||||
cfg = config.amazonImage;
|
||||
amiBootMode = if config.ec2.efi then "uefi" else "legacy-bios";
|
||||
virtualisationOptions = import ../../../modules/virtualisation/virtualisation-options.nix;
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
imports = [ ../../../modules/virtualisation/amazon-image.nix ];
|
||||
imports = [
|
||||
../../../modules/virtualisation/amazon-image.nix
|
||||
virtualisationOptions.diskSize
|
||||
(lib.mkRenamedOptionModuleWith {
|
||||
sinceRelease = 2411;
|
||||
from = [
|
||||
"virtualisation"
|
||||
"amazonImage"
|
||||
"sizeMB"
|
||||
];
|
||||
to = [
|
||||
"virtualisation"
|
||||
"diskSize"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
# Amazon recommends setting this to the highest possible value for a good EBS
|
||||
# experience, which prior to 4.15 was 255.
|
||||
@ -52,13 +67,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
sizeMB = mkOption {
|
||||
type = with types; either (enum [ "auto" ]) int;
|
||||
default = 3072;
|
||||
example = 8192;
|
||||
description = "The size in MB of the image";
|
||||
};
|
||||
|
||||
format = mkOption {
|
||||
type = types.enum [
|
||||
"raw"
|
||||
@ -70,6 +78,9 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config.virtualisation.diskSize = lib.mkDefault (3 * 1024);
|
||||
config.virtualisation.diskSizeAutoSupported = !config.ec2.zfs.enable;
|
||||
|
||||
config.system.build.amazonImage =
|
||||
let
|
||||
configFile = pkgs.writeText "configuration.nix" ''
|
||||
@ -98,7 +109,7 @@ in
|
||||
|
||||
bootSize = 1000; # 1G is the minimum EBS volume
|
||||
|
||||
rootSize = cfg.sizeMB;
|
||||
rootSize = config.virtualisation.diskSize;
|
||||
rootPoolProperties = {
|
||||
ashift = 12;
|
||||
autoexpand = "on";
|
||||
@ -151,7 +162,7 @@ in
|
||||
fsType = "ext4";
|
||||
partitionTableType = if config.ec2.efi then "efi" else "legacy+gpt";
|
||||
|
||||
diskSize = cfg.sizeMB;
|
||||
inherit (config.virtualisation) diskSize;
|
||||
|
||||
postVM = ''
|
||||
extension=''${diskImage##*.}
|
||||
|
@ -312,7 +312,7 @@ in rec {
|
||||
[ configuration
|
||||
versionModule
|
||||
./maintainers/scripts/ec2/amazon-image.nix
|
||||
({ ... }: { amazonImage.sizeMB = "auto"; })
|
||||
({ ... }: { amazonImage.virtualisation.diskSize = "auto"; })
|
||||
];
|
||||
}).config.system.build.amazonImage)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user