From d08171639407f91e8cc6e0576e9f3fa5a104a378 Mon Sep 17 00:00:00 2001 From: oqyude Date: Tue, 16 Sep 2025 19:49:38 +0300 Subject: [PATCH] 123 --- homeConfigurations/modules/external.nix | 8 +++ nixosModules/options.nix | 5 ++ nixosModules/primary/default.nix | 1 + nixosModules/services/zapret-old.nix | 47 ++++++++++++++++ nixosModules/services/zapret.nix | 73 +++++++++++-------------- 5 files changed, 92 insertions(+), 42 deletions(-) create mode 100644 nixosModules/services/zapret-old.nix diff --git a/homeConfigurations/modules/external.nix b/homeConfigurations/modules/external.nix index 43f3c06..cb26d8f 100755 --- a/homeConfigurations/modules/external.nix +++ b/homeConfigurations/modules/external.nix @@ -6,6 +6,14 @@ ... }: { + xdg = { + dataFile = { + "PrismLauncher" = { + source = config.lib.file.mkOutOfStoreSymlink "${xlib.dirs.soptur-drive}/Games/PrismLauncher"; + target = "PrismLauncher"; + }; + }; + }; home.file = { "Storage" = { source = config.lib.file.mkOutOfStoreSymlink "${xlib.dirs.vetymae-drive}/Users/oqyude/Storage"; diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 90f74c5..38edaa2 100755 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -35,6 +35,11 @@ default = "/home/${config.xlib.device.username}"; description = "User home directory."; }; + user-services = lib.mkOption { + type = lib.types.str; + default = "${config.xlib.dirs.user-home}/Misc/Devices/Services"; + description = "User services directory."; + }; user-storage = lib.mkOption { type = lib.types.str; default = "${config.xlib.dirs.user-home}/Storage"; diff --git a/nixosModules/primary/default.nix b/nixosModules/primary/default.nix index e343ffa..73aa2d1 100755 --- a/nixosModules/primary/default.nix +++ b/nixosModules/primary/default.nix @@ -5,5 +5,6 @@ { imports = [ ../desktop + ../services/zapret.nix ]; } diff --git a/nixosModules/services/zapret-old.nix b/nixosModules/services/zapret-old.nix new file mode 100644 index 0000000..ca19b70 --- /dev/null +++ b/nixosModules/services/zapret-old.nix @@ -0,0 +1,47 @@ +{ pkgs, ... }: +#? 🙏 https://github.com/ViZiD/dotfiles/blob/master/modules/shared/zapret.nix +#? https://github.com/Flowseal/zapret-discord-youtube/blob/main/general.bat +let + list-general = pkgs.fetchurl { + # https://github.com/Flowseal/zapret-discord-youtube/blob/main/lists/list-general.txt + url = "https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/779853740f9c957551685bdebf59ad3a788b5004/lists/list-general.txt"; + sha256 = "sha256-/9dYk5fiVLfN+bY0STlqutnRQQoInS9NBGg9fWHZedk="; + }; +in +{ + services.zapret = { + enable = true; + udpSupport = true; + udpPorts = [ + "443" + "50000:50099" + ]; + params = [ + "--filter-tcp=80" + "--hostlist=${list-general}" + "--dpi-desync=fake,split2" + "--dpi-desync-autottl=2" + "--dpi-desync-fooling=md5sig" + + "--new" + "--filter-tcp=443" + "--hostlist=${list-general}" + "--dpi-desync=fake,multidisorder" + "--dpi-desync-split-pos=midsld" + "--dpi-desync-repeats=8" + "--dpi-desync-fooling=md5sig,badseq" + + "--new" + "--filter-udp=443" + "--hostlist=${list-general}" + "--dpi-desync=fake" + "--dpi-desync-repeats=6" + + "--new" + "--filter-udp=50000-50099" + "--filter-l7=discord,stun" + "--dpi-desync=fake" + "--dpi-desync-repeats=6" + ]; + }; +} diff --git a/nixosModules/services/zapret.nix b/nixosModules/services/zapret.nix index ca19b70..70542b5 100644 --- a/nixosModules/services/zapret.nix +++ b/nixosModules/services/zapret.nix @@ -1,47 +1,36 @@ -{ pkgs, ... }: -#? 🙏 https://github.com/ViZiD/dotfiles/blob/master/modules/shared/zapret.nix -#? https://github.com/Flowseal/zapret-discord-youtube/blob/main/general.bat -let - list-general = pkgs.fetchurl { - # https://github.com/Flowseal/zapret-discord-youtube/blob/main/lists/list-general.txt - url = "https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/779853740f9c957551685bdebf59ad3a788b5004/lists/list-general.txt"; - sha256 = "sha256-/9dYk5fiVLfN+bY0STlqutnRQQoInS9NBGg9fWHZedk="; - }; -in +{ config, pkgs, ... }: { - services.zapret = { + systemd.services.zapret = { enable = true; - udpSupport = true; - udpPorts = [ - "443" - "50000:50099" - ]; - params = [ - "--filter-tcp=80" - "--hostlist=${list-general}" - "--dpi-desync=fake,split2" - "--dpi-desync-autottl=2" - "--dpi-desync-fooling=md5sig" - - "--new" - "--filter-tcp=443" - "--hostlist=${list-general}" - "--dpi-desync=fake,multidisorder" - "--dpi-desync-split-pos=midsld" - "--dpi-desync-repeats=8" - "--dpi-desync-fooling=md5sig,badseq" - - "--new" - "--filter-udp=443" - "--hostlist=${list-general}" - "--dpi-desync=fake" - "--dpi-desync-repeats=6" - - "--new" - "--filter-udp=50000-50099" - "--filter-l7=discord,stun" - "--dpi-desync=fake" - "--dpi-desync-repeats=6" + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + description = "Custom Script Service"; + path = with pkgs; [ + sudo + git + nftables + iproute2 + coreutils ]; + serviceConfig = { + Type = "simple"; + WorkingDirectory = "${xlib.dirs.user-services}/Misc/Devices/Services/zapret/137"; + User = "root"; + ExecStart = '' + ${pkgs.bash}/bin/bash ${xlib.dirs.user-services}/Misc/Devices/Services/zapret/main_script.sh -nointeractive + ''; + ExecStop = '' + ${pkgs.bash}/bin/bash ${xlib.dirs.user-services}/Misc/Devices/Services/zapret/stop_and_clean_nft.sh + ''; + ExecStopPost = '' + ${pkgs.coreutils}/bin/echo "Сервис завершён" + ''; + PIDFile = '' + /run/zapret_discord_youtube.pid + ''; + Restart = "on-failure"; + RestartSec = "5s"; + }; }; + }