config/modules/services/tailscale/default.nix

30 lines
714 B
Nix
Raw Normal View History

{
config,
lib,
myData,
...
}: let
cfg = config.mj.services.tailscale;
inherit (lib) mkMerge types mkEnableOption mkOption mkIf;
in {
options.mj.services.tailscale = with types; {
enable = mkEnableOption "Enable tailscale";
# https://github.com/tailscale/tailscale/issues/1548
silenceLogs = mkOption {
type = bool;
default = false;
};
};
config = mkIf (cfg.enable) (mkMerge [
{
services.tailscale.enable = true;
2023-09-14 14:48:54 +03:00
networking.firewall.checkReversePath = "loose";
2023-09-14 14:51:36 +03:00
networking.firewall.allowedUDPPorts = [myData.ports.tailscale];
}
(mkIf cfg.silenceLogs {
systemd.services.tailscaled.serviceConfig.StandardOutput = "null";
})
]);
}