feat: add tailscale

This commit is contained in:
Jacob Bachmann 2024-08-22 11:27:48 +02:00
parent f451acb559
commit 89b88b9082
Signed by: bchmnn
GPG key ID: 732A612DAD28067D
3 changed files with 32 additions and 2 deletions

View file

@ -84,7 +84,7 @@ in
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${pkgs.wofi}/bin/wofi";
# TODO for some reason bar only works when used with exec
bars = [];
bars = [ ];
startup = with pkgs; [
# TODO activate with systemd prbly requires a graphical.target?
# { command = "${nixosConfig.systemd.package}/bin/systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP"; }
@ -103,6 +103,7 @@ in
{ command = "${plasma5Packages.kdeconnect-kde}/bin/kdeconnect-indicator"; }
{ command = "${system-config-printer}/bin/system-config-printer-applet"; }
{ command = "${emote}/bin/emote"; }
{ command = "${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; }
];
input = {
"2:7:SynPS/2_Synaptics_TouchPad" = {

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, nixosConfig, ... }:
let
check-battery = pkgs.writeShellScript "check-battery" ''
bat=/sys/class/power_supply/BAT0
@ -18,6 +18,20 @@ let
rm $FILE
fi
'';
tailscale-status = pkgs.writeShellScript "tailscale-status" ''
if ${nixosConfig.services.tailscale.package}/bin/tailscale status > /dev/null 2>&1; then
echo
else
echo
fi
'';
tailscale-toggle = pkgs.writeShellScript "tailscale-toggle" ''
if ${nixosConfig.services.tailscale.package}/bin/tailscale status > /dev/null 2>&1; then
pkexec ${nixosConfig.services.tailscale.package}/bin/tailscale down
else
pkexec ${nixosConfig.services.tailscale.package}/bin/tailscale up --accept-routes --exit-node=j4m35-bl0nd
fi
'';
in
{
xdg.configFile = {
@ -115,6 +129,7 @@ in
"modules-right": [
"tray",
"network",
"custom/tailscale",
"pulseaudio",
"disk",
"custom/mem",
@ -135,6 +150,11 @@ in
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-wifi": "{essid} ({signalStrength}%) "
},
"custom/tailscale": {
"exec": "${tailscale-status}",
"interval": 1,
"on-click": "${tailscale-toggle}",
},
"pulseaudio": {
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
@ -268,6 +288,13 @@ in
background: transparent;
}
window.swaybar #custom-tailscale {
padding-right: 10px;
transition: none;
color: black;
background: transparent;
}
window.swaybar #pulseaudio {
padding-left: 10px;
padding-right: 10px;