summaryrefslogtreecommitdiff
path: root/nixos/modules/linode.nix
blob: d70c929fd1039d67abf12953184a5845f9dd1959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ config, pkgs, lib, ... }:
with lib;

# from https://www.linode.com/docs/tools-reference/custom-kernels-distros/install-nixos-on-linode/.

let 
  cfg = config.eth.linode;

in {

  options.eth.linode = {
    enable = mkEnableOption "good defaults for Linodes";
  };

  config = mkIf cfg.enable {

    # Enable LISH serial console.
    boot.kernelParams = [ "console=ttyS0,19200n8" ];
    boot.loader.grub.extraConfig = ''
      serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
      terminal_input serial;
      terminal_output serial;
    '';

    # GRUB has issues with Linode,
    # so this ignores the warnings.
    boot.loader.grub.forceInstall = true;
  
    # A long timeout to cope with LISH delays.
    boot.loader.timeout = 10;
  
    boot.loader.grub = {
      enable = true;
      version = 2;
      device = "nodev";  # "nodev" for EFI.
    };
  };
}