flakes/modules/system/tailscale.nix

27 lines
888 B
Nix
Raw Permalink Normal View History

{ config, lib, ... }: {
2026-05-28 20:55:11 +10:00
age.secrets.tailscale_auth.file = ../../secrets/tailscale_auth.age;
me.binds."/var/lib/tailscale" = "tailscale";
networking.firewall.trustedInterfaces = [ "tailscale0" ];
2026-06-10 15:06:38 +10:00
networking.firewall.allowedUDPPorts = lib.mkIf (config.me.environment == "headless") [ 123 ];
networking.nat = lib.mkIf (config.networking.hostName == "dandelion") {
enable = true;
externalInterface = "enp0s6";
internalInterfaces = [ "tailscale0" ];
forwardPorts = [
{
sourcePort = 50300;
proto = "tcp";
destination = "100.67.2.101:50300";
}
];
};
2026-06-17 00:26:09 +10:00
networking.firewall.allowedTCPPorts = [ 50300 ];
2026-05-28 20:55:11 +10:00
services.tailscale = {
enable = true;
authKeyFile = config.age.secrets.tailscale_auth.path;
openFirewall = true;
useRoutingFeatures = if config.me.environment == "headless" then "both" else "client";
2026-05-28 20:55:11 +10:00
};
}