lol

nixos/ec2: remove paravirtualization-specific code

Paravirtualized EC2 instances haven't been supported since 2017.
It's safe to remove this now.

+8 -28
+2 -7
nixos/maintainers/scripts/ec2/amazon-image.nix
··· 43 43 44 44 sizeMB = mkOption { 45 45 type = with types; either (enum [ "auto" ]) int; 46 - default = if config.ec2.hvm then 2048 else 8192; 46 + default = 2048; 47 47 example = 8192; 48 48 description = lib.mdDoc "The size in MB of the image"; 49 49 }; ··· 60 60 '' 61 61 { modulesPath, ... }: { 62 62 imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ]; 63 - ${optionalString config.ec2.hvm '' 64 - ec2.hvm = true; 65 - ''} 66 63 ${optionalString config.ec2.efi '' 67 64 ec2.efi = true; 68 65 ''} ··· 129 126 pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package 130 127 131 128 fsType = "ext4"; 132 - partitionTableType = if config.ec2.efi then "efi" 133 - else if config.ec2.hvm then "legacy+gpt" 134 - else "none"; 129 + partitionTableType = if config.ec2.efi then "efi" else "legacy+gpt"; 135 130 136 131 diskSize = cfg.sizeMB; 137 132
+3 -12
nixos/modules/virtualisation/amazon-image.nix
··· 31 31 config = { 32 32 33 33 assertions = [ 34 - { assertion = cfg.hvm; 35 - message = "Paravirtualized EC2 instances are no longer supported."; 36 - } 37 - { assertion = cfg.efi -> cfg.hvm; 38 - message = "EC2 instances using EFI must be HVM instances."; 39 - } 40 34 { assertion = versionOlder config.boot.kernelPackages.kernel.version "5.17"; 41 35 message = "ENA driver fails to build with kernel >= 5.17"; 42 36 } 43 37 ]; 44 38 45 - boot.growPartition = cfg.hvm; 39 + boot.growPartition = true; 46 40 47 41 fileSystems."/" = mkIf (!cfg.zfs.enable) { 48 42 device = "/dev/disk/by-label/nixos"; ··· 66 60 ]; 67 61 boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ]; 68 62 boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ]; 69 - boot.kernelParams = mkIf cfg.hvm [ "console=ttyS0,115200n8" "random.trust_cpu=on" ]; 63 + boot.kernelParams = [ "console=ttyS0,115200n8" "random.trust_cpu=on" ]; 70 64 71 65 # Prevent the nouveau kernel module from being loaded, as it 72 66 # interferes with the nvidia/nvidia-uvm modules needed for CUDA. ··· 74 68 # boot. 75 69 boot.blacklistedKernelModules = [ "nouveau" "xen_fbfront" ]; 76 70 77 - # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd. 78 - boot.loader.grub.version = if cfg.hvm then 2 else 1; 79 - boot.loader.grub.device = if (cfg.hvm && !cfg.efi) then "/dev/xvda" else "nodev"; 80 - boot.loader.grub.extraPerEntryConfig = mkIf (!cfg.hvm) "root (hd0)"; 71 + boot.loader.grub.device = if cfg.efi then "nodev" else "/dev/xvda"; 81 72 boot.loader.grub.efiSupport = cfg.efi; 82 73 boot.loader.grub.efiInstallAsRemovable = cfg.efi; 83 74 boot.loader.timeout = 1;
+3 -7
nixos/modules/virtualisation/amazon-options.nix
··· 2 2 let 3 3 inherit (lib) literalExpression types; 4 4 in { 5 + imports = [ 6 + (lib.mkRemovedOptionModule [ "ec2" "hvm" ] "Only HVM instances are supported, so specifying it is no longer necessary.") 7 + ]; 5 8 options = { 6 9 ec2 = { 7 10 zfs = { ··· 40 43 }; 41 44 }); 42 45 }; 43 - }; 44 - hvm = lib.mkOption { 45 - default = lib.versionAtLeast config.system.stateVersion "17.03"; 46 - internal = true; 47 - description = lib.mdDoc '' 48 - Whether the EC2 instance is a HVM instance. 49 - ''; 50 46 }; 51 47 efi = lib.mkOption { 52 48 default = pkgs.stdenv.hostPlatform.isAarch64;
-2
nixos/tests/ec2.nix
··· 16 16 ../modules/testing/test-instrumentation.nix 17 17 ../modules/profiles/qemu-guest.nix 18 18 { 19 - ec2.hvm = true; 20 - 21 19 # Hack to make the partition resizing work in QEMU. 22 20 boot.initrd.postDeviceCommands = mkBefore '' 23 21 ln -s vda /dev/xvda