2024-07-23 20:50:11 +00:00
|
|
|
{ lib, config, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.lab.tailscale;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
lab.tailscale.advertiseExitNode = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-22 20:54:08 +00:00
|
|
|
config = {
|
|
|
|
services.tailscale = {
|
|
|
|
enable = true;
|
|
|
|
authKeyFile = config.sops.secrets."tailscale/authKey".path;
|
2024-07-23 20:50:11 +00:00
|
|
|
useRoutingFeatures = "server";
|
|
|
|
openFirewall = true;
|
2024-07-22 20:54:08 +00:00
|
|
|
|
|
|
|
extraUpFlags = [
|
|
|
|
"--hostname=${config.networking.hostName}"
|
2024-07-23 20:50:11 +00:00
|
|
|
] ++ lib.lists.optional cfg.advertiseExitNode "--advertise-exit-node"
|
|
|
|
++ lib.lists.optional cfg.advertiseExitNode "--advertise-routes=192.168.30.0/24";
|
2024-07-22 20:54:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sops.secrets."tailscale/authKey" = { };
|
|
|
|
};
|
|
|
|
}
|