···2828 # partition of reasonable size is created in addition to the root partition.
2929 # For "legacy", the msdos partition table is used and a single large root
3030 # partition is created.
3131+ # For "legacy+gpt", the GPT partition table is used, a 1MiB no-fs partition for
3232+ # use by the bootloader is created, and a single large root partition is
3333+ # created.
3134 # For "hybrid", the GPT partition table is used and a mandatory ESP
3235 # partition of reasonable size is created in addition to the root partition.
3336 # Also a legacy MBR will be present.
···5457 format ? "raw"
5558}:
56595757-assert partitionTableType == "legacy" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
6060+assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
5861# We use -E offset=X below, which is only supported by e2fsprogs
5962assert partitionTableType != "none" -> fsType == "ext4";
6063···75787679 rootPartition = { # switch-case
7780 legacy = "1";
8181+ "legacy+gpt" = "2";
7882 efi = "2";
7983 hybrid = "3";
8084 }.${partitionTableType};
···8488 parted --script $diskImage -- \
8589 mklabel msdos \
8690 mkpart primary ext4 1MiB -1
9191+ '';
9292+ "legacy+gpt" = ''
9393+ parted --script $diskImage -- \
9494+ mklabel gpt \
9595+ mkpart no-fs 1MB 2MB \
9696+ set 1 bios_grub on \
9797+ align-check optimal 1 \
9898+ mkpart primary ext4 2MB -1 \
9999+ align-check optimal 2 \
100100+ print
87101 '';
88102 efi = ''
89103 parted --script $diskImage -- \
+1-1
nixos/maintainers/scripts/ec2/amazon-image.nix
···5757 inherit (cfg) contents format name;
5858 pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
5959 partitionTableType = if config.ec2.efi then "efi"
6060- else if config.ec2.hvm then "legacy"
6060+ else if config.ec2.hvm then "legacy+gpt"
6161 else "none";
6262 diskSize = cfg.sizeMB;
6363 fsType = "ext4";