Files
nix/modules/server/tailscale.nix
Gustavo "Guz" L. de Mello 5ce99497d7 refactor!: I went too close into the sun
Simlified everything, things were getting out of control
2024-04-08 16:37:29 -03:00

37 lines
644 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;};
};
}