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

-5
View File
@@ -9,7 +9,6 @@
let
pkgs = import nixpkgs { inherit system; };
suitePkgs = import ../pkgs/default.nix { inherit pkgs; };
parserChecks = import ./checks/parsers.nix { inherit pkgs; };
checkLib = import ./checks/lib.nix {
inherit
@@ -28,7 +27,6 @@ let
;
inherit (checkLib) rg;
readmeDocSource = builtins.readFile ../nix/readme-doc.nix;
trayModuleSource = builtins.readFile ../modules/proxy-suite/tray.nix;
tgWsProxyModuleSource = builtins.readFile ../modules/proxy-suite/tg-ws-proxy.nix;
controlModuleSource = builtins.readFile ../modules/proxy-suite/service/control.nix;
};
@@ -41,9 +39,6 @@ let
};
in
moduleSuiteChecks
// {
proxy-suite-tray-build = suitePkgs.proxy-suite-tray;
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
amneziawg-runtime = amneziaWgRuntime;
proxy-inbounds-runtime = proxyInboundsRuntime;
+81
View File
@@ -0,0 +1,81 @@
{
evalProxySuite,
baseModule,
packagePathMatches,
}:
let
guiFixture = evalProxySuite [
baseModule
{ services.proxy-suite.gui.enable = true; }
];
guiManualFixture = evalProxySuite [
baseModule
{
services.proxy-suite.gui = {
enable = true;
autostart = false;
};
}
];
# The old tray options still work, as renames of the GUI's.
deprecatedTrayFixture = evalProxySuite [
baseModule
{
services.proxy-suite.tray = {
enable = true;
pollInterval = 7;
};
}
];
tuiOffFixture = evalProxySuite [
baseModule
{ services.proxy-suite.tui.enable = false; }
];
guiPackage = ".*/[^/]*proxy-suite-gui(-[0-9.]+)?$";
in
{
assertions = [
(
assert packagePathMatches guiManualFixture.config.environment.systemPackages ".*/[^/]*proxy-tui$";
assert !(packagePathMatches tuiOffFixture.config.environment.systemPackages ".*/[^/]*proxy-tui$");
assert !(packagePathMatches tuiOffFixture.config.environment.systemPackages guiPackage);
true
)
(
assert packagePathMatches guiFixture.config.environment.systemPackages guiPackage;
assert packagePathMatches guiManualFixture.config.environment.systemPackages guiPackage;
true
)
(
let
unit = guiFixture.config.systemd.user.services.proxy-suite-gui;
in
assert unit.wantedBy == [ "graphical-session.target" ];
assert builtins.elem "graphical-session.target" unit.partOf;
assert builtins.match ".*/bin/proxy-suite-gui --hidden$" unit.serviceConfig.ExecStart != null;
true
)
(
assert !(guiManualFixture.config.systemd.user.services ? proxy-suite-gui);
assert !(tuiOffFixture.config.systemd.user.services ? proxy-suite-gui);
true
)
(
let
cfg = deprecatedTrayFixture.config;
in
assert cfg.services.proxy-suite.gui.enable;
assert cfg.services.proxy-suite.gui.refreshInterval == 7;
assert packagePathMatches cfg.environment.systemPackages guiPackage;
assert builtins.any (
w: builtins.match ".*services\\.proxy-suite\\.gui\\.enable.*" w != null
) cfg.warnings;
true
)
];
}
+3 -2
View File
@@ -85,7 +85,7 @@ let
;
};
trayChecks = import ./tray.nix {
guiChecks = import ./gui.nix {
inherit
evalProxySuite
baseModule
@@ -256,7 +256,7 @@ let
++ zapretChecks.assertions
++ zapret2Checks.assertions
++ globalProxyModeChecks.assertions
++ trayChecks.assertions
++ guiChecks.assertions
++ subscriptionChecks.assertions
++ routeModeChecks.assertions
++ perAppRoutingChecks.assertions
@@ -269,4 +269,5 @@ in
per-app-zapret-runtime = perAppRoutingChecks.runtime;
zapret-hostlist-rules = zapretChecks.rules;
zapret2-config = zapret2Checks.runtime;
proxy-suite-gui-build = _minimalProxyCtl.proxyCtl.gui;
}
+28 -2
View File
@@ -4,7 +4,6 @@
generatedOptionsDoc,
generatedReadmeDoc,
readmeDocSource,
trayModuleSource,
tgWsProxyModuleSource,
controlModuleSource,
}:
@@ -424,6 +423,34 @@
touch "$out"
'';
# proxy_model: the status strip, tab loads and the tray menu tree, without a UI toolkit.
proxy-model-unit =
pkgs.runCommand "proxy-suite-proxy-model-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; } ''
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_model.py
touch "$out"
'';
# proxy_gui and proxy_sni import against GTK4/libadwaita, the D-Bus interfaces parse,
# and the tray menu serializes to dbusmenu's layout type. No display needed.
proxy-gui-smoke =
pkgs.runCommand "proxy-suite-proxy-gui-smoke-check"
{
nativeBuildInputs = [
(pkgs.python3.withPackages (ps: [ ps.pygobject3 ]))
pkgs.gobject-introspection
];
buildInputs = [
pkgs.gtk4
pkgs.libadwaita
];
}
''
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_gui.py
touch "$out"
'';
# autoProxy slowness routing: sampler and judge.
autoproxy-slowness =
pkgs.runCommand "proxy-suite-autoproxy-slowness-check"
@@ -613,7 +640,6 @@
) (pkgs.writeText "proxy-suite-readme-doc-source-check" "ok");
package-source = builtins.seq (
assert !(pkgs.lib.hasInfix "../../pkgs/proxy-suite-tray.nix" trayModuleSource);
assert !(pkgs.lib.hasInfix "../../pkgs/tg-ws-proxy.nix" tgWsProxyModuleSource);
assert !(pkgs.lib.hasInfix "../../../pkgs/proxy-ctl.nix" controlModuleSource);
true
-65
View File
@@ -1,65 +0,0 @@
{
evalProxySuite,
baseModule,
packagePathMatches,
}:
let
trayAutostartFixture = evalProxySuite [
baseModule
{
services.proxy-suite.tray.enable = true;
}
];
trayManualFixture = evalProxySuite [
baseModule
{
services.proxy-suite.tray = {
enable = true;
autostart = false;
};
}
];
tuiOffFixture = evalProxySuite [
baseModule
{ services.proxy-suite.tui.enable = false; }
];
in
{
assertions = [
(
assert packagePathMatches trayManualFixture.config.environment.systemPackages ".*/[^/]*proxy-tui$";
assert !(packagePathMatches tuiOffFixture.config.environment.systemPackages ".*/[^/]*proxy-tui$");
true
)
(
assert packagePathMatches trayAutostartFixture.config.environment.systemPackages
".*/[^/]*proxy-suite-tray(-[0-9.]+)?$";
true
)
(
assert packagePathMatches trayAutostartFixture.config.environment.systemPackages
".*/[^/]*proxy-suite-tray\\.desktop$";
true
)
(
assert
builtins.match ".*/share/xdg/autostart/proxy-suite-tray\\.desktop$" (
builtins.unsafeDiscardStringContext
trayAutostartFixture.config.environment.etc."xdg/autostart/proxy-suite-tray.desktop".source
) != null;
true
)
(
assert !(trayManualFixture.config.environment.etc ? "xdg/autostart/proxy-suite-tray.desktop");
true
)
(
assert packagePathMatches trayManualFixture.config.environment.systemPackages
".*/[^/]*proxy-suite-tray\\.desktop$";
true
)
];
}
+16 -13
View File
@@ -17,21 +17,24 @@ let
];
};
# Visible options only (renamed aliases are hidden), packages shown by name.
# Visible options only (renamed aliases are hidden, and so are groups left
# with nothing but aliases), packages shown by name.
visibleConfig =
opts: cfg:
lib.mapAttrs (
name: opt:
if !lib.isOption opt then
visibleConfig opt cfg.${name}
else if lib.isDerivation cfg.${name} then
{
__pretty = _: "pkgs.${lib.getName cfg.${name}}";
val = null;
}
else
cfg.${name}
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts);
lib.filterAttrs (name: value: lib.isOption opts.${name} || value != { }) (
lib.mapAttrs (
name: opt:
if !lib.isOption opt then
visibleConfig opt cfg.${name}
else if lib.isDerivation cfg.${name} then
{
__pretty = _: "pkgs.${lib.getName cfg.${name}}";
val = null;
}
else
cfg.${name}
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts)
);
optionDocs = pkgs.nixosOptionsDoc {
options.services.proxy-suite = eval.options.services.proxy-suite;