dotfiles/nixos/tailscale/default.nix

33 lines
761 B
Nix
Raw Normal View History

2023-08-13 17:00:41 +01:00
{
config,
pkgs,
inputs,
system,
2023-08-13 17:00:41 +01:00
...
}: let
inherit
(inputs.nixpkgs-nixos-unstable.legacyPackages."${system}")
2023-08-13 17:00:41 +01:00
tailscale
;
in {
2023-08-13 17:00:41 +01:00
environment.systemPackages = [tailscale];
services.tailscale = {
enable = true;
package = tailscale;
authKeyFile = "/run/secrets/tailscale-key-${config.networking.hostName}";
2024-06-13 13:15:58 +01:00
extraUpFlags = ["--stateful-filtering"];
};
systemd.services.tailscaled = {
serviceConfig.LogLevelMax = "notice";
};
networking.firewall = {
2023-08-13 17:00:41 +01:00
trustedInterfaces = ["tailscale0"];
allowedUDPPorts = [config.services.tailscale.port];
};
sops.secrets."tailscale-key-${config.networking.hostName}" = {
sopsFile = ./keys.sops.yaml;
restartUnits = ["tailscaled-autoconnect.service"];
};
}