2023-08-13 17:00:41 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit
|
|
|
|
(inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux")
|
|
|
|
tailscale
|
|
|
|
;
|
2022-08-19 18:51:44 +01:00
|
|
|
in {
|
2023-08-13 17:00:41 +01:00
|
|
|
environment.systemPackages = [tailscale];
|
2022-08-19 18:51:44 +01:00
|
|
|
services.tailscale = {
|
|
|
|
enable = true;
|
|
|
|
package = tailscale;
|
2023-12-08 17:52:51 +00:00
|
|
|
authKeyFile = "/run/secrets/tailscale-key-${config.networking.hostName}";
|
|
|
|
};
|
|
|
|
systemd.services.tailscaled = {
|
|
|
|
serviceConfig.LogLevelMax = "notice";
|
2022-08-19 18:51:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall = {
|
2023-08-13 17:00:41 +01:00
|
|
|
trustedInterfaces = ["tailscale0"];
|
|
|
|
allowedUDPPorts = [config.services.tailscale.port];
|
2022-08-19 18:51:44 +01:00
|
|
|
};
|
|
|
|
sops.secrets."tailscale-key-${config.networking.hostName}" = {
|
|
|
|
sopsFile = ./keys.sops.yaml;
|
2023-12-08 17:52:51 +00:00
|
|
|
restartUnits = ["tailscaled-autoconnect.service"];
|
2022-08-19 18:51:44 +01:00
|
|
|
};
|
|
|
|
}
|