Skip to content

Commit 4f3c131

Browse files
committed
flake: add machine Halcyon
1 parent 81b7d09 commit 4f3c131

3 files changed

Lines changed: 90 additions & 1 deletion

File tree

flake.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@
7070
secretsPath
7171
;
7272
};
73-
nixosMachines = ["Mizuka" "Quebec"];
73+
nixosMachines = [
74+
"Mizuka"
75+
"Quebec"
76+
"Halcyon"
77+
];
7478
darwinMachines = ["Schwarzschild"];
7579
in
7680
flake-parts.lib.mkFlake {inherit inputs;} ({
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
lib,
3+
hostname,
4+
...
5+
}: {
6+
imports = [
7+
../../roles/server
8+
../../disk-layouts/simple.nix
9+
];
10+
11+
networking.hostName = hostname;
12+
13+
services.qemuGuest.enable = true;
14+
15+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
16+
}

nixos/roles/server/default.nix

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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

Comments
 (0)