{ config, lib, pkgs, ... }: { services.tailscale = { enable = true; # Required for the systray to control tailscale without root extraSetFlags = [ "--operator=alex" ]; }; networking.firewall = { checkReversePath = "loose"; allowedUDPPorts = [ 41641 ]; }; home-manager.users.alex = { # The official tailscale systray, including the node list and exit nodes services.tailscale-systray = { enable = true; package = config.services.tailscale.package; }; # The systray never retries if no tray exists when it starts, so wait for the # AppIndicator extension to provide one. This is done in the main process, # rather than `ExecStartPre`, to not block activation while waiting systemd.user.services.tailscale-systray.Service.ExecStart = lib.mkForce (toString ( pkgs.writeShellScript "tailscale-systray" '' until ${pkgs.systemd}/bin/busctl --user status org.kde.StatusNotifierWatcher >/dev/null 2>&1; do sleep 1 done exec ${lib.getExe config.services.tailscale.package} systray '' )); programs.gnome-shell = { enable = true; extensions = [ # GNOME has no system tray without it { package = pkgs.gnomeExtensions.appindicator; } ]; }; }; }