|
| 1 | +_: { |
| 2 | + # Boot |
| 3 | + boot.loader.systemd-boot.enable = true; |
| 4 | + boot.loader.efi.canTouchEfiVariables = true; |
| 5 | + boot.loader.systemd-boot.configurationLimit = 5; |
| 6 | + |
| 7 | + # No need for fonts and documentation on a server |
| 8 | + documentation.man.enable = true; |
| 9 | + documentation.dev.enable = false; |
| 10 | + documentation.doc.enable = false; |
| 11 | + documentation.nixos.enable = false; |
| 12 | + fonts.fontconfig.enable = false; |
| 13 | + |
| 14 | + programs.vim = { |
| 15 | + enable = true; |
| 16 | + defaultEditor = true; |
| 17 | + }; |
| 18 | + programs.git.enable = true; |
| 19 | + |
| 20 | + users.mutableUsers = false; |
| 21 | + |
| 22 | + # Access |
| 23 | + users.users.root = { |
| 24 | + initialHashedPassword = "$y$j9T$KHYs8lBhE5S.gupM7N/QE/$zurxi/XMT5n6aACZu9tz3RBLBQ6Ge/eCUwODOjRMqe0"; |
| 25 | + openssh.authorizedKeys.keys = [ |
| 26 | + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHL5pMTK8LGrizHB2VvgL1RG9cNKxAhYXb59NqSyAwpw" |
| 27 | + ]; |
| 28 | + }; |
| 29 | + networking.firewall = { |
| 30 | + enable = true; |
| 31 | + }; |
| 32 | + services.openssh = { |
| 33 | + enable = true; |
| 34 | + settings.PasswordAuthentication = false; |
| 35 | + settings.KbdInteractiveAuthentication = false; |
| 36 | + settings.PermitRootLogin = "prohibit-password"; |
| 37 | + }; |
| 38 | + |
| 39 | + systemd = { |
| 40 | + # Given that our systems are headless, emergency mode is useless. |
| 41 | + # We prefer the system to attempt to continue booting so |
| 42 | + # that we can hopefully still access it remotely. |
| 43 | + enableEmergencyMode = false; |
| 44 | + |
| 45 | + # For more detail, see: |
| 46 | + # https://0pointer.de/blog/projects/watchdog.html |
| 47 | + settings.Manager = { |
| 48 | + # systemd will send a signal to the hardware watchdog at half |
| 49 | + # the interval defined here, so every 10s. |
| 50 | + # If the hardware watchdog does not get a signal for 20s, |
| 51 | + # it will forcefully reboot the system. |
| 52 | + RuntimeWatchdogSec = "20s"; |
| 53 | + # Forcefully reboot if the final stage of the reboot |
| 54 | + # hangs without progress for more than 30s. |
| 55 | + # For more info, see: |
| 56 | + # https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdShutdownWatchdog |
| 57 | + RebootWatchdogSec = "30s"; |
| 58 | + # Forcefully reboot when a host hangs after kexec. |
| 59 | + # This may be the case when the firmware does not support kexec. |
| 60 | + KExecWatchdogSec = "1m"; |
| 61 | + }; |
| 62 | + }; |
| 63 | + |
| 64 | + # use TCP BBR has significantly increased throughput and reduced latency for connections |
| 65 | + boot.kernel.sysctl = { |
| 66 | + "net.core.default_qdisc" = "fq"; |
| 67 | + "net.ipv4.tcp_congestion_control" = "bbr"; |
| 68 | + }; |
| 69 | +} |
0 commit comments