2024-03-24 08:33:03 +00:00
|
|
|
{ pkgs }:
|
|
|
|
let
|
2024-03-24 08:36:12 +00:00
|
|
|
systemctl-toggle' = pkgs.writeShellApplication {
|
2024-03-24 08:33:03 +00:00
|
|
|
name = "systemctl-toggle";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.systemd
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
if systemctl is-active "$@"; then
|
|
|
|
systemctl stop "$@"
|
|
|
|
else
|
|
|
|
systemctl start "$@"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2024-03-24 08:36:12 +00:00
|
|
|
systemctl-toggle = "${systemctl-toggle'}/bin/systemctl-toggle";
|
2024-03-24 08:33:03 +00:00
|
|
|
|
2024-03-24 08:36:12 +00:00
|
|
|
print-is-active' = pkgs.writeShellApplication {
|
2024-03-24 08:33:03 +00:00
|
|
|
name = "print-is-active";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.systemd
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
if systemctl is-active "$@"; then
|
|
|
|
echo true
|
|
|
|
else
|
|
|
|
echo false
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2024-03-24 08:36:12 +00:00
|
|
|
print-is-active = "${print-is-active'}/bin/print-is-active";
|
2024-03-24 08:33:03 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
gps = {
|
|
|
|
type = "toggle";
|
|
|
|
label = ""; # GPS services; other icons: gps, ⌖, 🛰, 🌎,
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle} eg25-control-gps";
|
|
|
|
update-command = "${print-is-active} eg25-control-gps.service";
|
2024-03-24 08:33:03 +00:00
|
|
|
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.
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle} eg25-control-powered";
|
|
|
|
update-command = "${print-is-active} eg25-control-powered.service";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
vpn = {
|
|
|
|
type = "toggle";
|
|
|
|
label = "vpn::hn"; # route all traffic through servo; useful to debug moby's networking
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle} wg-quick-vpn-servo";
|
|
|
|
update-command = "${print-is-active} wg-quick-vpn-servo.service";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
gnome-calls = {
|
|
|
|
type = "toggle";
|
|
|
|
label = "SIP";
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user gnome-calls";
|
|
|
|
update-command = "${print-is-active} --user gnome-calls";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
geary = {
|
|
|
|
type = "toggle";
|
|
|
|
label = ""; # email (Geary); other icons: ✉, [E], 📧,
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user geary";
|
|
|
|
update-command = "${print-is-active} --user geary";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
abaddon = {
|
|
|
|
type = "toggle";
|
|
|
|
label = ""; # Discord chat client; icons: , 🎮
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user abaddon";
|
|
|
|
update-command = "${print-is-active} --user abaddon";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
dissent = {
|
|
|
|
type = "toggle";
|
|
|
|
label = ""; # Discord chat client; icons: , 🎮
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user dissent";
|
|
|
|
update-command = "${print-is-active} --user dissent";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
signal-desktop = {
|
|
|
|
type = "toggle";
|
|
|
|
label = "💬"; # Signal messenger; other icons:
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user signal-desktop";
|
|
|
|
update-command = "${print-is-active} --user signal-desktop";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
dino = {
|
|
|
|
type = "toggle";
|
|
|
|
label = "XMPP"; # XMPP calls (jingle)
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user dino";
|
|
|
|
update-command = "${print-is-active} --user dino";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
fractal = {
|
|
|
|
type = "toggle";
|
|
|
|
label = "[m]"; # Matrix messages
|
2024-03-24 08:36:12 +00:00
|
|
|
command = "${systemctl-toggle} --user fractal";
|
|
|
|
update-command = "${print-is-active} --user fractal";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
|
|
|
}
|