dotfiles/nixos/tailscale/default.nix

31 lines
709 B
Nix
Raw Normal View History

2023-08-13 17:00:41 +01:00
{
config,
pkgs,
inputs,
...
}: let
inherit
(inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux")
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}";
};
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"];
};
}