infra/nix/seattle/configuration.nix

108 lines
2.2 KiB
Nix
Raw Normal View History

2023-06-26 15:25:26 +01:00
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware.nix
];
boot = {
2023-07-30 22:39:00 +01:00
supportedFilesystems = [ "nfs" ];
2023-06-26 15:25:26 +01:00
kernelPackages = pkgs.linuxPackages_rpi4;
2023-08-06 00:03:44 +01:00
kernelParams = [ "cgroup_enable=memory" "cgroup_enable=cpuset" "cgroup_memory=1" ];
2023-06-26 15:25:26 +01:00
loader = {
grub.enable = false;
2023-07-30 22:39:00 +01:00
generic-extlinux-compatible.enable = true;
2023-06-26 15:25:26 +01:00
};
};
swapDevices = [
{
device = "/var/lib/swapfile";
size = 8*1024;
}
];
2023-07-30 22:39:00 +01:00
2023-06-26 15:25:26 +01:00
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";
2023-09-05 21:44:01 +01:00
allowedTCPPorts = [ 22 80 443 6443 10250 ];
allowedUDPPorts = [ 41641 80 443 ];
enable = false;
2023-06-26 15:25:26 +01:00
};
2023-09-05 21:44:01 +01:00
nftables.enable = false;
2023-06-26 15:25:26 +01:00
};
time.timeZone = "Europe/London";
users.users.gsimmer = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
tree
];
2023-11-30 12:10:26 +00:00
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);
2023-06-26 15:25:26 +01:00
};
environment.systemPackages = with pkgs; [
vim
wget
htop
git
screen
nix-output-monitor
tailscale
nfs-utils
libraspberrypi
];
services = {
2023-07-30 22:39:00 +01:00
rpcbind.enable = true;
2023-06-26 15:25:26 +01:00
openssh.enable = true;
tailscale.enable = true;
k3s = {
enable = true;
role = "server";
extraFlags = toString [
2023-09-25 10:48:31 +01:00
"--secrets-encryption --disable=traefik,servicelb"
2023-06-26 15:25:26 +01:00
];
};
};
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
};
system.stateVersion = "23.11"; # dId YoU rEaD tHe CoMmEnT?
}