feat: proxy-gui
This commit is contained in:
44 files changed
+2994
-2016
No files matched your search
@@ -182,18 +182,6 @@ in
|
||||
;
|
||||
}
|
||||
))
|
||||
|
||||
(lib.mkIf cfg.tray.enable (
|
||||
import ./tray.nix {
|
||||
inherit
|
||||
config
|
||||
lib
|
||||
pkgs
|
||||
packages
|
||||
cfg
|
||||
;
|
||||
}
|
||||
))
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
./warp.nix
|
||||
./tg-ws-proxy.nix
|
||||
./geodata.nix
|
||||
./gui.nix
|
||||
./tray.nix
|
||||
./tui.nix
|
||||
./user-control.nix
|
||||
|
||||
@@ -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.";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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"))
|
||||
];
|
||||
}
|
||||
@@ -182,6 +182,7 @@ let
|
||||
inherit (scripts) proxyInboundsLinksFile proxyInboundsSubscriptionsFile;
|
||||
proxyInboundsSubscriptionsBaseUrl = proxyInboundsCfg.subscriptions.baseUrl;
|
||||
inherit amneziaWgProfileNamesFile;
|
||||
guiRefreshInterval = cfg.gui.refreshInterval;
|
||||
inherit (perAppRouting)
|
||||
perAppRoutingProfilesFile
|
||||
proxychainsConfigFile
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user