infra/nix/seattle/configuration.nix
2024-03-31 02:06:43 +01:00

108 lines
2.3 KiB
Nix

{
config,
pkgs,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware.nix
];
boot = {
supportedFilesystems = ["nfs"];
kernelPackages = pkgs.linuxPackages_rpi4;
kernelParams = ["cgroup_enable=memory" "cgroup_enable=cpuset" "cgroup_memory=1"];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};
nix = {
settings = {
auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
networking = {
hostName = "seattle";
domain = "gmem.ca";
firewall = {
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
allowedTCPPorts = [22 80 443 6443 10250];
allowedUDPPorts = [41641 80 443];
enable = false;
};
nftables.enable = false;
};
time.timeZone = "Europe/London";
users.users.gsimmer = {
isNormalUser = true;
extraGroups = ["wheel"];
packages = with pkgs; [
tree
];
openssh.authorizedKeys.keys = let
authorizedKeys = pkgs.fetchurl {
url = "https://gmem.ca/ssh";
hash = "sha256-7PpFDgWVfp26c9PuW+2s3O8MBAODtHr4q7WU/l3BoG4=";
};
in
pkgs.lib.splitString "\n" (builtins.readFile
authorizedKeys);
};
environment.systemPackages = with pkgs; [
vim
wget
htop
git
screen
nix-output-monitor
tailscale
nfs-utils
libraspberrypi
];
services = {
rpcbind.enable = true;
openssh.enable = true;
tailscale.enable = true;
k3s = {
enable = true;
role = "server";
extraFlags = toString [
"--secrets-encryption --disable=traefik,servicelb --kube-apiserver-arg service-node-port-range=69-32767"
];
};
};
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
deviceTree = {
enable = true;
filter = "*rpi-4-*.dtb";
};
};
system.stateVersion = "23.11"; # dId YoU rEaD tHe CoMmEnT?
}