feat: proxy-gui

This commit is contained in:
FUFSoB committed 2026-09-15 00:15:53 +05:00
1 parent 8ed4ab9a8d
commit 7de094078c
44 files changed
+2994 -2016

No files matched your search

-12
View File
@@ -182,18 +182,6 @@ in
;
}
))
(lib.mkIf cfg.tray.enable (
import ./tray.nix {
inherit
config
lib
pkgs
packages
cfg
;
}
))
]
))
];
+1
View File
@@ -17,6 +17,7 @@
./warp.nix
./tg-ws-proxy.nix
./geodata.nix
./gui.nix
./tray.nix
./tui.nix
./user-control.nix
+25
View File
@@ -0,0 +1,25 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.services.proxy-suite.gui = {
enable = mkEnableOption "Proxy Suite GUI, a desktop app with a tray icon for everything proxy-ctl controls at runtime";
autostart = mkOption {
type = types.bool;
default = true;
description = ''
Start the GUI hidden in the tray with graphical sessions, as the
`proxy-suite-gui` systemd user unit on `graphical-session.target`.
'';
};
refreshInterval = mkOption {
type = types.ints.positive;
default = 3;
description = "Status refresh interval, in seconds.";
};
};
}
+13 -16
View File
@@ -1,22 +1,19 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption mkOption types;
p =
path:
[
"services"
"proxy-suite"
]
++ lib.splitString "." path;
in
{
options.services.proxy-suite.tray = {
enable = mkEnableOption "the system tray indicator";
autostart = mkOption {
type = types.bool;
default = true;
description = "Start the tray in graphical sessions (XDG autostart).";
};
pollInterval = mkOption {
type = types.ints.positive;
default = 5;
description = "Status refresh interval, in seconds.";
};
};
# The tray indicator became Proxy Suite GUI, which has the tray icon built in.
imports = [
(lib.mkRenamedOptionModule (p "tray.enable") (p "gui.enable"))
(lib.mkRenamedOptionModule (p "tray.autostart") (p "gui.autostart"))
(lib.mkRenamedOptionModule (p "tray.pollInterval") (p "gui.refreshInterval"))
];
}
+1
View File
@@ -182,6 +182,7 @@ let
inherit (scripts) proxyInboundsLinksFile proxyInboundsSubscriptionsFile;
proxyInboundsSubscriptionsBaseUrl = proxyInboundsCfg.subscriptions.baseUrl;
inherit amneziaWgProfileNamesFile;
guiRefreshInterval = cfg.gui.refreshInterval;
inherit (perAppRouting)
perAppRoutingProfilesFile
proxychainsConfigFile
+2
View File
@@ -23,6 +23,7 @@
proxyInboundsLinksFile,
proxyInboundsSubscriptionsFile,
proxyInboundsSubscriptionsBaseUrl,
guiRefreshInterval,
}:
{
proxyCtl = packages.mkProxyCtl {
@@ -36,6 +37,7 @@
proxychainsQuietArg
routeModeStateFile
amneziaWgProfileNamesFile
guiRefreshInterval
;
defaultRouteMode = if (proxyCfg.routing.default == "proxy") then "blacklist" else "whitelist";
perAppRoutingEnabled = if perAppRoutingCfg.enable then "1" else "0";
+26 -2
View File
@@ -135,7 +135,11 @@ in
lib.mkMerge [
autoProxyUnits
{
environment.systemPackages = [ control.proxyCtl ] ++ lib.optional cfg.tui.enable control.proxyCtl.tui;
environment.systemPackages = [
control.proxyCtl
]
++ lib.optional cfg.tui.enable control.proxyCtl.tui
++ lib.optional cfg.gui.enable control.proxyCtl.gui;
# nftables must be on for transparent routing backends. Global TUN uses
# SingBox auto_redirect programs an `inet sing-box` nftables table.
@@ -195,7 +199,27 @@ lib.mkMerge [
]
);
systemd.user.services = mkNamedUnits userServiceEntries;
systemd.user.services = lib.mkMerge [
(mkNamedUnits userServiceEntries)
(lib.mkIf (cfg.gui.enable && cfg.gui.autostart) {
# Starts hidden in the tray with every graphical session.
proxy-suite-gui = {
description = "Proxy Suite GUI (tray icon)";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
unitConfig.ConditionEnvironment = [
"|WAYLAND_DISPLAY"
"|DISPLAY"
];
serviceConfig = {
ExecStart = "${control.proxyCtl.gui}/bin/proxy-suite-gui --hidden";
Restart = "on-failure";
RestartSec = 3;
};
};
})
];
assertions = import ../service-assertions.nix {
inherit lib cfg derived;
-55
View File
@@ -1,55 +0,0 @@
# Tray indicator module for proxy-suite
{
config,
lib,
pkgs,
packages,
cfg,
}:
let
tray = cfg.tray;
proxyTray = packages.mkProxySuiteTray {
pollInterval = tray.pollInterval;
};
desktopEntryText = ''
[Desktop Entry]
Type=Application
Version=1.0
Name=Proxy Suite Tray
Comment=System tray indicator for proxy-suite
Exec=${proxyTray}/bin/proxy-suite-tray
Icon=network-vpn
Categories=Network;System;
StartupNotify=false
Terminal=false
'';
desktopEntry = pkgs.writeTextFile {
name = "proxy-suite-tray.desktop";
destination = "/share/applications/proxy-suite-tray.desktop";
text = desktopEntryText;
};
autostartEntry = pkgs.writeTextFile {
name = "proxy-suite-tray-autostart.desktop";
destination = "/share/xdg/autostart/proxy-suite-tray.desktop";
text = ''
${desktopEntryText}
X-GNOME-Autostart-enabled=true
'';
};
in
{
environment.systemPackages = [
proxyTray
desktopEntry
];
environment.etc = lib.mkIf tray.autostart {
"xdg/autostart/proxy-suite-tray.desktop".source =
"${autostartEntry}/share/xdg/autostart/proxy-suite-tray.desktop";
};
}