1{ config, lib, pkgs, ... }:
2with lib;
3{
4 imports = [ ../profiles/qemu-guest.nix ];
5
6 services.openssh = {
7 enable = true;
8
9 settings.PermitRootLogin = "prohibit-password";
10 settings.PasswordAuthentication = mkDefault false;
11 };
12
13 networking = {
14 usePredictableInterfaceNames = false;
15 useDHCP = false;
16 interfaces.eth0 = {
17 useDHCP = true;
18
19 # Linode expects IPv6 privacy extensions to be disabled, so disable them
20 # See: https://www.linode.com/docs/guides/manual-network-configuration/#static-vs-dynamic-addressing
21 tempAddress = "disabled";
22 };
23 };
24
25 # Install diagnostic tools for Linode support
26 environment.systemPackages = with pkgs; [
27 inetutils
28 mtr
29 sysstat
30 ];
31
32 fileSystems."/" = {
33 fsType = "ext4";
34 device = "/dev/sda";
35 autoResize = true;
36 };
37
38 swapDevices = mkDefault [{ device = "/dev/sdb"; }];
39
40 # Enable LISH and Linode Booting w/ GRUB
41 boot = {
42 # Add Required Kernel Modules
43 # NOTE: These are not documented in the install guide
44 initrd.availableKernelModules = [
45 "virtio_pci"
46 "virtio_scsi"
47 "ahci"
48 "sd_mod"
49 ];
50
51 # Set Up LISH Serial Connection
52 kernelParams = [ "console=ttyS0,19200n8" ];
53 kernelModules = [ "virtio_net" ];
54
55 loader = {
56 # Increase Timeout to Allow LISH Connection
57 # NOTE: The image generator tries to set a timeout of 0, so we must force
58 timeout = lib.mkForce 10;
59
60 grub = {
61 enable = true;
62 version = 2;
63 forceInstall = true;
64 device = "nodev";
65
66 # Allow serial connection for GRUB to be able to use LISH
67 extraConfig = ''
68 serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
69 terminal_input serial;
70 terminal_output serial
71 '';
72 };
73 };
74 };
75}