summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-05-18 16:16:44 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-05-18 16:16:44 +0100
commitd404cffb5462daee18e2e1a233a9b054856865d6 (patch)
treef00b648e6ff16bbe071819b235912fc7ad4947d2
parent08f8ee3dd6a0a67ae3667524fd279f7b02993f65 (diff)
add Linode settings to modules
-rw-r--r--module-list.nix1
-rw-r--r--modules/linode.nix38
2 files changed, 39 insertions, 0 deletions
diff --git a/module-list.nix b/module-list.nix
index 3bb9ee3..9981930 100644
--- a/module-list.nix
+++ b/module-list.nix
@@ -1,4 +1,5 @@
[
./modules/keyboard.nix
+ ./modules/linode.nix
./modules/yubikey.nix
]
diff --git a/modules/linode.nix b/modules/linode.nix
new file mode 100644
index 0000000..d70c929
--- /dev/null
+++ b/modules/linode.nix
@@ -0,0 +1,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.
+ };
+ };
+}