2022-10-22 22:18:32 +01:00
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
imports = [
|
2022-12-04 13:24:08 +00:00
|
|
|
|
./hardware-configuration.nix
|
2023-01-02 21:50:11 +00:00
|
|
|
|
../../modules/rpi/rpi4.nix
|
2022-10-22 22:18:32 +01:00
|
|
|
|
];
|
|
|
|
|
|
2023-04-17 21:22:04 +01:00
|
|
|
|
config = {
|
|
|
|
|
system.stateVersion = "22.05";
|
|
|
|
|
|
|
|
|
|
networking.hostName = "microserver";
|
|
|
|
|
networking.domain = "home.ts.hillion.co.uk";
|
|
|
|
|
|
2024-04-27 12:45:03 +01:00
|
|
|
|
custom.defaults = true;
|
|
|
|
|
|
2023-12-24 22:09:53 +00:00
|
|
|
|
## Custom Services
|
|
|
|
|
custom.locations.autoServe = true;
|
|
|
|
|
|
2023-04-17 21:22:04 +01:00
|
|
|
|
# Networking
|
|
|
|
|
## Tailscale
|
|
|
|
|
age.secrets."tailscale/microserver.home.ts.hillion.co.uk".file = ../../secrets/tailscale/microserver.home.ts.hillion.co.uk.age;
|
2024-02-11 22:24:35 +00:00
|
|
|
|
services.tailscale = {
|
2023-04-17 21:22:04 +01:00
|
|
|
|
enable = true;
|
2024-02-11 22:24:35 +00:00
|
|
|
|
authKeyFile = config.age.secrets."tailscale/microserver.home.ts.hillion.co.uk".path;
|
|
|
|
|
useRoutingFeatures = "server";
|
|
|
|
|
extraUpFlags = [
|
|
|
|
|
"--advertise-routes"
|
|
|
|
|
"10.64.50.0/24,10.239.19.0/24"
|
|
|
|
|
"--advertise-exit-node"
|
|
|
|
|
];
|
2022-10-22 22:18:32 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 21:22:04 +01:00
|
|
|
|
## Enable IoT VLAN
|
|
|
|
|
networking.vlans = {
|
|
|
|
|
vlan2 = {
|
|
|
|
|
id = 2;
|
|
|
|
|
interface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-18 20:33:01 +00:00
|
|
|
|
hardware = {
|
|
|
|
|
bluetooth.enable = true;
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 21:22:04 +01:00
|
|
|
|
## Enable IP forwarding for Tailscale
|
|
|
|
|
boot.kernel.sysctl = {
|
|
|
|
|
"net.ipv4.ip_forward" = true;
|
|
|
|
|
};
|
2023-02-04 14:49:55 +00:00
|
|
|
|
|
2023-04-17 21:22:04 +01:00
|
|
|
|
## Run a persistent iperf3 server
|
|
|
|
|
services.iperf3.enable = true;
|
|
|
|
|
services.iperf3.openFirewall = true;
|
2023-06-19 20:00:33 +01:00
|
|
|
|
|
2024-04-26 19:29:13 +01:00
|
|
|
|
networking.nameservers = lib.mkForce [ ]; # Trust the DHCP nameservers
|
2023-12-24 22:09:53 +00:00
|
|
|
|
networking.firewall.interfaces = {
|
|
|
|
|
"eth0" = {
|
|
|
|
|
allowedUDPPorts = [
|
|
|
|
|
5353 # HomeKit
|
|
|
|
|
];
|
|
|
|
|
allowedTCPPorts = [
|
2024-04-22 20:49:43 +01:00
|
|
|
|
7654 # Tang
|
2023-12-24 22:09:53 +00:00
|
|
|
|
21063 # HomeKit
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-04-17 21:22:04 +01:00
|
|
|
|
};
|
2022-10-22 22:18:32 +01:00
|
|
|
|
}
|
|
|
|
|
|