Files
nix/modules/server/tailscale.nix
2024-03-03 11:53:16 -03:00

36 lines
641 B
Nix

{ config, lib, ... }:
let
cfg = config.server.tailscale;
in
{
imports = [
./network.nix
];
options.server.tailscale = with lib; with lib.types; {
enable = mkEnableOption "";
mode = mkOption {
type = enum [
"client"
"server"
"both"
];
default = "both";
};
exitNode = mkOption {
type = bool;
default = false;
};
settings = { };
};
config = lib.mkIf cfg.enable {
services.tailscale = {
enable = true;
useRoutingFeatures = cfg.mode;
};
server.network = lib.mkIf cfg.exitNode { portForwarding = lib.mkDefault true; };
};
}