From fdea25896e8f36bd0ecb986dc9089f4ea430bb53 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 10 Jul 2024 17:33:09 -0400 Subject: [PATCH] fix(desktop: make sure tailscale works at hyprland launch --- .../desktop/desktop-environment/packages.nix | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/modules/desktop/desktop-environment/packages.nix b/modules/desktop/desktop-environment/packages.nix index 3c7fb625..dfb541e9 100644 --- a/modules/desktop/desktop-environment/packages.nix +++ b/modules/desktop/desktop-environment/packages.nix @@ -6,17 +6,34 @@ self, ... }: let - inherit (lib) makeLibraryPath mkIf optionalString; + inherit (lib) getExe makeLibraryPath mkIf optionals optionalString; inherit (pkgs.writers) writeTOML; flakeDir = config.environment.variables.FLAKE; cfg = config.roles.desktop; nvidiaEnable = config.nvidia.enable; + + restartTailscale = pkgs.writeShellScriptBin "restartTailscale" '' + sudo ${pkgs.systemd}/bin/systemctl restart tailscaled.service + ''; in { imports = [./dolphin.nix]; programs.kdeconnect.enable = true; + security.sudo.extraRules = [ + { + users = [cfg.user]; + groups = [100]; + commands = [ + { + command = "${pkgs.systemd}/bin/systemctl restart tailscaled.service"; + options = ["SETENV" "NOPASSWD"]; + } + ]; + } + ]; + home-manager.users.${cfg.user} = { imports = [ ./home/foot.nix @@ -182,17 +199,21 @@ in { wayland.windowManager.hyprland = { settings = { - exec-once = [ - "${config.programs.kdeconnect.package}/libexec/kdeconnectd" - "kdeconnect-indicator" + exec-once = + [ + "${config.programs.kdeconnect.package}/libexec/kdeconnectd" + "kdeconnect-indicator" - "wl-paste --watch cliphist store" + "wl-paste --watch cliphist store" - "sleep 3; nextcloud --background" + "sleep 3; nextcloud --background" - "[workspace special:protonmail silent] proton-mail" - "[workspace special:spot silent] spotify" - ]; + "[workspace special:protonmail silent] proton-mail" + "[workspace special:spot silent] spotify" + ] + ++ optionals config.services.tailscale.enable [ + "sleep 3; ${getExe restartTailscale}" + ]; windowrule = [ "tile,^(libreoffice)$"