nixos/ec2: remove paravirtualization-specific code

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

Changed files
+8 -28
nixos
maintainers
scripts
modules
tests
+2 -7
nixos/maintainers/scripts/ec2/amazon-image.nix
···
sizeMB = mkOption {
type = with types; either (enum [ "auto" ]) int;
-
default = if config.ec2.hvm then 2048 else 8192;
example = 8192;
description = lib.mdDoc "The size in MB of the image";
};
···
''
{ modulesPath, ... }: {
imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ];
-
${optionalString config.ec2.hvm ''
-
ec2.hvm = true;
-
''}
${optionalString config.ec2.efi ''
ec2.efi = true;
''}
···
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
fsType = "ext4";
-
partitionTableType = if config.ec2.efi then "efi"
-
else if config.ec2.hvm then "legacy+gpt"
-
else "none";
diskSize = cfg.sizeMB;
···
sizeMB = mkOption {
type = with types; either (enum [ "auto" ]) int;
+
default = 2048;
example = 8192;
description = lib.mdDoc "The size in MB of the image";
};
···
''
{ modulesPath, ... }: {
imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ];
${optionalString config.ec2.efi ''
ec2.efi = true;
''}
···
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
fsType = "ext4";
+
partitionTableType = if config.ec2.efi then "efi" else "legacy+gpt";
diskSize = cfg.sizeMB;
+3 -12
nixos/modules/virtualisation/amazon-image.nix
···
config = {
assertions = [
-
{ assertion = cfg.hvm;
-
message = "Paravirtualized EC2 instances are no longer supported.";
-
}
-
{ assertion = cfg.efi -> cfg.hvm;
-
message = "EC2 instances using EFI must be HVM instances.";
-
}
{ assertion = versionOlder config.boot.kernelPackages.kernel.version "5.17";
message = "ENA driver fails to build with kernel >= 5.17";
}
];
-
boot.growPartition = cfg.hvm;
fileSystems."/" = mkIf (!cfg.zfs.enable) {
device = "/dev/disk/by-label/nixos";
···
];
boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ];
-
boot.kernelParams = mkIf cfg.hvm [ "console=ttyS0,115200n8" "random.trust_cpu=on" ];
# Prevent the nouveau kernel module from being loaded, as it
# interferes with the nvidia/nvidia-uvm modules needed for CUDA.
···
# boot.
boot.blacklistedKernelModules = [ "nouveau" "xen_fbfront" ];
-
# Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
-
boot.loader.grub.version = if cfg.hvm then 2 else 1;
-
boot.loader.grub.device = if (cfg.hvm && !cfg.efi) then "/dev/xvda" else "nodev";
-
boot.loader.grub.extraPerEntryConfig = mkIf (!cfg.hvm) "root (hd0)";
boot.loader.grub.efiSupport = cfg.efi;
boot.loader.grub.efiInstallAsRemovable = cfg.efi;
boot.loader.timeout = 1;
···
config = {
assertions = [
{ assertion = versionOlder config.boot.kernelPackages.kernel.version "5.17";
message = "ENA driver fails to build with kernel >= 5.17";
}
];
+
boot.growPartition = true;
fileSystems."/" = mkIf (!cfg.zfs.enable) {
device = "/dev/disk/by-label/nixos";
···
];
boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ];
+
boot.kernelParams = [ "console=ttyS0,115200n8" "random.trust_cpu=on" ];
# Prevent the nouveau kernel module from being loaded, as it
# interferes with the nvidia/nvidia-uvm modules needed for CUDA.
···
# boot.
boot.blacklistedKernelModules = [ "nouveau" "xen_fbfront" ];
+
boot.loader.grub.device = if cfg.efi then "nodev" else "/dev/xvda";
boot.loader.grub.efiSupport = cfg.efi;
boot.loader.grub.efiInstallAsRemovable = cfg.efi;
boot.loader.timeout = 1;
+3 -7
nixos/modules/virtualisation/amazon-options.nix
···
let
inherit (lib) literalExpression types;
in {
options = {
ec2 = {
zfs = {
···
};
});
};
-
};
-
hvm = lib.mkOption {
-
default = lib.versionAtLeast config.system.stateVersion "17.03";
-
internal = true;
-
description = lib.mdDoc ''
-
Whether the EC2 instance is a HVM instance.
-
'';
};
efi = lib.mkOption {
default = pkgs.stdenv.hostPlatform.isAarch64;
···
let
inherit (lib) literalExpression types;
in {
+
imports = [
+
(lib.mkRemovedOptionModule [ "ec2" "hvm" ] "Only HVM instances are supported, so specifying it is no longer necessary.")
+
];
options = {
ec2 = {
zfs = {
···
};
});
};
};
efi = lib.mkOption {
default = pkgs.stdenv.hostPlatform.isAarch64;
-2
nixos/tests/ec2.nix
···
../modules/testing/test-instrumentation.nix
../modules/profiles/qemu-guest.nix
{
-
ec2.hvm = true;
-
# Hack to make the partition resizing work in QEMU.
boot.initrd.postDeviceCommands = mkBefore ''
ln -s vda /dev/xvda
···
../modules/testing/test-instrumentation.nix
../modules/profiles/qemu-guest.nix
{
# Hack to make the partition resizing work in QEMU.
boot.initrd.postDeviceCommands = mkBefore ''
ln -s vda /dev/xvda