Enable console on serial port and print public ssh host key when booting

This commit is contained in:
yuri 2023-08-01 14:21:06 +02:00
parent 4b18856559
commit e122ca0006
3 changed files with 24 additions and 1 deletions

View file

@ -51,5 +51,23 @@
preliminarySelfsigned = true;
};
# Print the ed25519 public ssh host key to console when booting
systemd.units."print-public-ssh-host-key.service" = {
enable = true;
text = ''
[Unit]
Description=print-public-ssh-host-key.service
Before=getty@tty1.service
[Service]
Type=oneshot
ExecStart=/run/current-system/sw/bin/bash -c "/run/current-system/sw/bin/echo ----- ED25519 PUBLIC SSH HOST KEY -----\
&& /run/current-system/sw/bin/cut -d ' ' -f 1-2 /etc/ssh/ssh_host_ed25519_key.pub"
RemainAfterExit=no
StandardOutput=tty
'';
wantedBy = [ "multi-user.target" ];
};
services.fstrim.enable = true;
}

View file

@ -1,4 +1,10 @@
{ ... }:
{
# Enable console output on TTY1 and serial console
boot.kernelParams = [
"console=tty1"
"console=ttyS0,115200"
];
services.qemuGuest.enable = true;
}

View file

@ -7,7 +7,6 @@ let
./configuration/proxmox-vm/hardware-configuration.nix
];
};
#
generateDefaults = hosts: builtins.mapAttrs (name: {
hostNixpkgs ? nixpkgs,
system ? "x86_64-linux",