32 lines
1.1 KiB
Nix
32 lines
1.1 KiB
Nix
{ config, ... }:
|
|
{
|
|
services.tailscale = {
|
|
enable = true;
|
|
useRoutingFeatures = "both";
|
|
extraUpFlags = [ "--ssh" ];
|
|
};
|
|
|
|
networking = {
|
|
nftables.enable = true;
|
|
firewall = {
|
|
enable = true;
|
|
# Always allow traffic from your Tailscale network
|
|
trustedInterfaces = [ "${config.services.tailscale.interfaceName}" ];
|
|
# Allow the Tailscale UDP port through the firewall
|
|
allowedUDPPorts = [ config.services.tailscale.port ];
|
|
checkReversePath = "loose";
|
|
};
|
|
};
|
|
|
|
# 2. Force tailscaled to use nftables (Critical for clean nftables-only systems)
|
|
# This avoids the "iptables-compat" translation layer issues.
|
|
systemd.services.tailscaled.serviceConfig.Environment = [
|
|
"TS_DEBUG_FIREWALL_MODE=nftables"
|
|
];
|
|
|
|
# 3. Optimization: Prevent systemd from waiting for network online
|
|
# (Optional but recommended for faster boot with VPNs)
|
|
# systemd.network.wait-online.enable = false;
|
|
# boot.initrd.systemd.network.wait-online.enable = false;
|
|
systemd.network.wait-online.ignoredInterfaces = [ "${config.services.tailscale.interfaceName}" ];
|
|
}
|