NixOS AWS AMI: enable the serial console on ttyS0

Changed files
+13 -2
nixos
modules
profiles
virtualisation
+1 -1
nixos/modules/profiles/headless.nix
···
boot.vesa = false;
# Don't start a tty on the serial consoles.
-
systemd.services."serial-getty@ttyS0".enable = false;
+
systemd.services."serial-getty@ttyS0".enable = lib.mkDefault false;
systemd.services."serial-getty@hvc0".enable = false;
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@".enable = false;
+12 -1
nixos/modules/virtualisation/amazon-image.nix
···
in
{
-
imports = [ ../profiles/headless.nix ./ec2-data.nix ./amazon-init.nix ];
+
imports = [
+
../profiles/headless.nix
+
# Note: While we do use the headless profile, we also explicitly
+
# turn on the serial console on ttyS0 below. This is because
+
# AWS does support accessing the serial console:
+
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configure-access-to-serial-console.html
+
./ec2-data.nix
+
./amazon-init.nix
+
];
config = {
···
# at instance creation time.
services.openssh.enable = true;
services.openssh.permitRootLogin = "prohibit-password";
+
+
# Enable the serial console on ttyS0
+
systemd.services."serial-getty@ttyS0".enable = true;
# Creates symlinks for block device names.
services.udev.packages = [ pkgs.ec2-utils ];