mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
nixos/ec2: remove paravirtualization-specific code
Paravirtualized EC2 instances haven't been supported since 2017. It's safe to remove this now.
This commit is contained in:
parent
5931cbe8ae
commit
24e33a4d2e
|
@ -43,7 +43,7 @@ in {
|
||||||
|
|
||||||
sizeMB = mkOption {
|
sizeMB = mkOption {
|
||||||
type = with types; either (enum [ "auto" ]) int;
|
type = with types; either (enum [ "auto" ]) int;
|
||||||
default = if config.ec2.hvm then 2048 else 8192;
|
default = 2048;
|
||||||
example = 8192;
|
example = 8192;
|
||||||
description = lib.mdDoc "The size in MB of the image";
|
description = lib.mdDoc "The size in MB of the image";
|
||||||
};
|
};
|
||||||
|
@ -60,9 +60,6 @@ in {
|
||||||
''
|
''
|
||||||
{ modulesPath, ... }: {
|
{ modulesPath, ... }: {
|
||||||
imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ];
|
imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ];
|
||||||
${optionalString config.ec2.hvm ''
|
|
||||||
ec2.hvm = true;
|
|
||||||
''}
|
|
||||||
${optionalString config.ec2.efi ''
|
${optionalString config.ec2.efi ''
|
||||||
ec2.efi = true;
|
ec2.efi = true;
|
||||||
''}
|
''}
|
||||||
|
@ -129,9 +126,7 @@ in {
|
||||||
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
|
||||||
|
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
partitionTableType = if config.ec2.efi then "efi"
|
partitionTableType = if config.ec2.efi then "efi" else "legacy+gpt";
|
||||||
else if config.ec2.hvm then "legacy+gpt"
|
|
||||||
else "none";
|
|
||||||
|
|
||||||
diskSize = cfg.sizeMB;
|
diskSize = cfg.sizeMB;
|
||||||
|
|
||||||
|
|
|
@ -31,18 +31,12 @@ in
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
assertions = [
|
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";
|
{ assertion = versionOlder config.boot.kernelPackages.kernel.version "5.17";
|
||||||
message = "ENA driver fails to build with kernel >= 5.17";
|
message = "ENA driver fails to build with kernel >= 5.17";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.growPartition = cfg.hvm;
|
boot.growPartition = true;
|
||||||
|
|
||||||
fileSystems."/" = mkIf (!cfg.zfs.enable) {
|
fileSystems."/" = mkIf (!cfg.zfs.enable) {
|
||||||
device = "/dev/disk/by-label/nixos";
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
@ -66,7 +60,7 @@ in
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
|
boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
|
||||||
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ];
|
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ];
|
||||||
boot.kernelParams = mkIf cfg.hvm [ "console=ttyS0,115200n8" "random.trust_cpu=on" ];
|
boot.kernelParams = [ "console=ttyS0,115200n8" "random.trust_cpu=on" ];
|
||||||
|
|
||||||
# Prevent the nouveau kernel module from being loaded, as it
|
# Prevent the nouveau kernel module from being loaded, as it
|
||||||
# interferes with the nvidia/nvidia-uvm modules needed for CUDA.
|
# interferes with the nvidia/nvidia-uvm modules needed for CUDA.
|
||||||
|
@ -74,10 +68,7 @@ in
|
||||||
# boot.
|
# boot.
|
||||||
boot.blacklistedKernelModules = [ "nouveau" "xen_fbfront" ];
|
boot.blacklistedKernelModules = [ "nouveau" "xen_fbfront" ];
|
||||||
|
|
||||||
# Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
|
boot.loader.grub.device = if cfg.efi then "nodev" else "/dev/xvda";
|
||||||
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.efiSupport = cfg.efi;
|
||||||
boot.loader.grub.efiInstallAsRemovable = cfg.efi;
|
boot.loader.grub.efiInstallAsRemovable = cfg.efi;
|
||||||
boot.loader.timeout = 1;
|
boot.loader.timeout = 1;
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
let
|
let
|
||||||
inherit (lib) literalExpression types;
|
inherit (lib) literalExpression types;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(lib.mkRemovedOptionModule [ "ec2" "hvm" ] "Only HVM instances are supported, so specifying it is no longer necessary.")
|
||||||
|
];
|
||||||
options = {
|
options = {
|
||||||
ec2 = {
|
ec2 = {
|
||||||
zfs = {
|
zfs = {
|
||||||
|
@ -41,13 +44,6 @@ in {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
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 {
|
efi = lib.mkOption {
|
||||||
default = pkgs.stdenv.hostPlatform.isAarch64;
|
default = pkgs.stdenv.hostPlatform.isAarch64;
|
||||||
defaultText = literalExpression "pkgs.stdenv.hostPlatform.isAarch64";
|
defaultText = literalExpression "pkgs.stdenv.hostPlatform.isAarch64";
|
||||||
|
|
|
@ -16,8 +16,6 @@ let
|
||||||
../modules/testing/test-instrumentation.nix
|
../modules/testing/test-instrumentation.nix
|
||||||
../modules/profiles/qemu-guest.nix
|
../modules/profiles/qemu-guest.nix
|
||||||
{
|
{
|
||||||
ec2.hvm = true;
|
|
||||||
|
|
||||||
# Hack to make the partition resizing work in QEMU.
|
# Hack to make the partition resizing work in QEMU.
|
||||||
boot.initrd.postDeviceCommands = mkBefore ''
|
boot.initrd.postDeviceCommands = mkBefore ''
|
||||||
ln -s vda /dev/xvda
|
ln -s vda /dev/xvda
|
||||||
|
|
Loading…
Reference in a new issue