105 lines
3.5 KiB
Nix
105 lines
3.5 KiB
Nix
|
{ pkgs }:
|
||
|
let
|
||
|
systemctl-toggle = pkgs.writeShellApplication {
|
||
|
name = "systemctl-toggle";
|
||
|
runtimeInputs = [
|
||
|
pkgs.systemd
|
||
|
];
|
||
|
text = ''
|
||
|
if systemctl is-active "$@"; then
|
||
|
systemctl stop "$@"
|
||
|
else
|
||
|
systemctl start "$@"
|
||
|
fi
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
printIsActive = pkgs.writeShellApplication {
|
||
|
name = "print-is-active";
|
||
|
runtimeInputs = [
|
||
|
pkgs.systemd
|
||
|
];
|
||
|
text = ''
|
||
|
if systemctl is-active "$@"; then
|
||
|
echo true
|
||
|
else
|
||
|
echo false
|
||
|
fi
|
||
|
'';
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
gps = {
|
||
|
type = "toggle";
|
||
|
label = ""; # GPS services; other icons: gps, ⌖, 🛰, 🌎,
|
||
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle eg25-control-gps";
|
||
|
update-command = "${printIsActive}/bin/print-is-active eg25-control-gps.service";
|
||
|
active = true;
|
||
|
};
|
||
|
cell-modem = {
|
||
|
type = "toggle";
|
||
|
label = ""; # icons: 5g, 📡, 📱, ᯤ, ⚡, , 🌐, 📶, 🗼, , , ,
|
||
|
# modem and NetworkManager auto-establishes a connection when powered.
|
||
|
# though some things like `wg-home` VPN tunnel will remain routed over the old interface.
|
||
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle eg25-control-powered";
|
||
|
update-command = "${printIsActive}/bin/print-is-active eg25-control-powered.service";
|
||
|
active = true;
|
||
|
};
|
||
|
vpn = {
|
||
|
type = "toggle";
|
||
|
label = "vpn::hn"; # route all traffic through servo; useful to debug moby's networking
|
||
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle wg-quick-vpn-servo";
|
||
|
update-command = "${printIsActive}/bin/print-is-active wg-quick-vpn-servo.service";
|
||
|
active = true;
|
||
|
};
|
||
|
gnome-calls = {
|
||
|
type = "toggle";
|
||
|
label = "SIP";
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user gnome-calls";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user gnome-calls";
|
||
|
active = true;
|
||
|
};
|
||
|
geary = {
|
||
|
type = "toggle";
|
||
|
label = ""; # email (Geary); other icons: ✉, [E], 📧,
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user geary";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user geary";
|
||
|
active = true;
|
||
|
};
|
||
|
abaddon = {
|
||
|
type = "toggle";
|
||
|
label = ""; # Discord chat client; icons: , 🎮
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user abaddon";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user abaddon";
|
||
|
active = true;
|
||
|
};
|
||
|
dissent = {
|
||
|
type = "toggle";
|
||
|
label = ""; # Discord chat client; icons: , 🎮
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user dissent";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user dissent";
|
||
|
active = true;
|
||
|
};
|
||
|
signal-desktop = {
|
||
|
type = "toggle";
|
||
|
label = "💬"; # Signal messenger; other icons:
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user signal-desktop";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user signal-desktop";
|
||
|
active = true;
|
||
|
};
|
||
|
dino = {
|
||
|
type = "toggle";
|
||
|
label = "XMPP"; # XMPP calls (jingle)
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user dino";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user dino";
|
||
|
active = true;
|
||
|
};
|
||
|
fractal = {
|
||
|
type = "toggle";
|
||
|
label = "[m]"; # Matrix messages
|
||
|
command = "${systemctl-toggle}/bin/systemctl-toggle --user fractal";
|
||
|
update-command = "${printIsActive}/bin/print-is-active --user fractal";
|
||
|
active = true;
|
||
|
};
|
||
|
}
|