Skip to content

gateway

The gateway host uses tailscale and firewall. knixl writes one file for it. The Nix below is the golden test output, so it is exactly what knixl emits.

hosts/gateway.kdl
host "gateway" {
system "x86_64-linux"
tailscale {
open-firewall #true
up-flag "--ssh"
set-flag "--advertise-exit-node"
auth-key secret="tailscale-authkey"
}
firewall {
nftables #true
allowed-tcp-port 443
allowed-udp-port 51820
allowed-tcp-range from=1714 to=1764
trusted-interface "tailscale0"
allow-ping #false
}
}
generated/hosts/gateway.nix
# Generated by knixl 1.8.0 from hosts/gateway.kdl
# Do NOT edit. Regenerate from the KDL source.
# Overrides: add a sibling module and use lib.mkForce / lib.mkAfter.
{
config,
lib,
pkgs,
...
}:
{
nixpkgs.hostPlatform = "x86_64-linux";
networking.hostName = "gateway";
services.tailscale.enable = true;
services.tailscale.openFirewall = true;
services.tailscale.extraUpFlags = [
"--ssh"
];
services.tailscale.extraSetFlags = [
"--advertise-exit-node"
];
services.tailscale.authKeyFile = config.sops.secrets."tailscale-authkey".path;
networking.nftables.enable = true;
networking.firewall.allowedTCPPorts = [
443
];
networking.firewall.allowedUDPPorts = [
51820
];
networking.firewall.allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
networking.firewall.trustedInterfaces = [
"tailscale0"
];
networking.firewall.allowPing = false;
}