Xray + system-wide proxy config. Fuck Turkey DPI :3

This commit is contained in:
Sergei Poljanski 2026-04-06 01:56:55 +03:00
commit f616fe50cc
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
4 changed files with 65 additions and 1 deletions

View file

@ -16,6 +16,7 @@
./modules/wireguard.nix ./modules/wireguard.nix
./modules/security.nix ./modules/security.nix
./modules/power.nix ./modules/power.nix
./modules/xray.nix
]; ];
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default

View file

@ -122,5 +122,6 @@
ivpn ivpn
ivpn-service ivpn-service
ivpn-ui ivpn-ui
xray
]; ];
} }

View file

@ -14,7 +14,7 @@
# Internet # Internet
thunderbird thunderbird
telegram-desktop telegram-desktop
firefox-devedition # firefox-devedition # managed via programs.firefox in xray.nix
# Music # Music
tidal-hifi tidal-hifi
# Discord # Discord

62
modules/xray.nix Normal file
View file

@ -0,0 +1,62 @@
# Xray VLESS+Reality proxy with system-wide proxy settings
{ config, pkgs, lib, ... }:
{
# Xray systemd service
systemd.services.xray = {
description = "Xray Proxy";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.xray}/bin/xray run -config /etc/xray/config.json";
Restart = "on-failure";
RestartSec = 5;
DynamicUser = true;
CapabilityBoundingSet = "";
NoNewPrivileges = true;
ProtectSystem = "strict";
ReadOnlyPaths = [ "/etc/xray" ];
};
};
# System-wide proxy environment variables
networking.proxy = {
default = "http://127.0.0.1:10809";
noProxy = "127.0.0.1,localhost,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16";
};
# Firefox proxy via enterprise policy
programs.firefox = {
enable = true;
package = pkgs.firefox-devedition;
policies = {
Proxy = {
Mode = "manual";
SOCKSProxy = "127.0.0.1:10808";
SOCKSVersion = 5;
Passthrough = "127.0.0.1,localhost";
UseProxyForDNS = true;
};
};
};
# GNOME proxy settings via dconf
programs.dconf.profiles.user.databases = [{
settings."org/gnome/system/proxy" = {
mode = "manual";
};
settings."org/gnome/system/proxy/http" = {
host = "127.0.0.1";
port = lib.gvariant.mkUint32 10809;
};
settings."org/gnome/system/proxy/https" = {
host = "127.0.0.1";
port = lib.gvariant.mkUint32 10809;
};
settings."org/gnome/system/proxy/socks" = {
host = "127.0.0.1";
port = lib.gvariant.mkUint32 10808;
};
}];
}