Enable console on serial port and print public ssh host key when booting
This commit is contained in:
		
					parent
					
						
							
								6885c40c10
							
						
					
				
			
			
				commit
				
					
						8a16dd0af2
					
				
			
		
					 3 changed files with 24 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,10 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  # Enable console output on TTY1 and serial console
 | 
			
		||||
  boot.kernelParams = [
 | 
			
		||||
    "console=tty1"
 | 
			
		||||
    "console=ttyS0,115200"
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  services.qemuGuest.enable = true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue