summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2022-03-24 08:58:54 -0700
committerGraham Christensen <graham@grahamc.com>2022-04-07 15:28:28 -0400
commit14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9 (patch)
tree8c1557dbd471a3066c0034b8368a42efb718b48a
parente5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f (diff)
downloadnixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar.gz
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar.bz2
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar.lz
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar.xz
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.tar.zst
nixpkgs-14304bfe40d8fa90f6a371cd6445a3ec7d09e0e9.zip
openstack-config: setup serial access on ttyS0
-rw-r--r--nixos/modules/virtualisation/openstack-config.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/openstack-config.nix b/nixos/modules/virtualisation/openstack-config.nix
index a5aa4b38eb6..0b392cca68e 100644
--- a/nixos/modules/virtualisation/openstack-config.nix
+++ b/nixos/modules/virtualisation/openstack-config.nix
@@ -11,7 +11,11 @@ in
 {
   imports = [
     ../profiles/qemu-guest.nix
+
+    # Note: While we do use the headless profile, we also explicitly
+    # turn on the serial console on ttyS0 below.
     ../profiles/headless.nix
+
     # The Openstack Metadata service exposes data on an EC2 API also.
     ./ec2-data.nix
     ./amazon-init.nix
@@ -36,6 +40,12 @@ in
     boot.loader.grub.device = if (!cfg.efi) then "/dev/vda" else "nodev";
     boot.loader.grub.efiSupport = cfg.efi;
     boot.loader.grub.efiInstallAsRemovable = cfg.efi;
+    boot.loader.timeout = 1;
+    boot.loader.grub.extraConfig = ''
+      serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
+      terminal_output console serial
+      terminal_input console serial
+    '';
 
     services.zfs.expandOnBoot = mkIf cfg.zfs.enable "all";
     boot.zfs.devNodes = mkIf cfg.zfs.enable "/dev/";
@@ -47,6 +57,11 @@ in
       passwordAuthentication = mkDefault false;
     };
 
+    users.users.root.initialPassword = "foobar";
+
+    # Enable the serial console on ttyS0
+    systemd.services."serial-getty@ttyS0".enable = true;
+
     # Force getting the hostname from Openstack metadata.
     networking.hostName = mkDefault "";