break tailscale into 2 configs for server and client
This commit is contained in:
36
modules/homelab/tailscale/default.nix
Normal file
36
modules/homelab/tailscale/default.nix
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.system.tailscale;
|
||||||
|
authkey_file = config.sops.secrets."tailscale_authkey".path;
|
||||||
|
in {
|
||||||
|
options.system.tailscale = {
|
||||||
|
enable = lib.mkEnableOption "enables tailscale";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.tailscale = {
|
||||||
|
enable = true;
|
||||||
|
useRoutingFeatures = "both";
|
||||||
|
authKeyFile = authkey_file;
|
||||||
|
extraUpFlags = [
|
||||||
|
"--accept-routes=false" # true is equilivant to useRoutingFeatures = "client" (breaks shit)
|
||||||
|
"--accept-dns=true" # explicitly allow resolved
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# network config
|
||||||
|
networking.firewall.trustedInterfaces = ["tailscale0"];
|
||||||
|
networking.firewall.allowedUDPPorts = [config.services.tailscale.port];
|
||||||
|
|
||||||
|
# declare authkey secrets
|
||||||
|
sops.secrets = {
|
||||||
|
"tailscale_authkey" = {
|
||||||
|
owner = "root";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user