Files
proxy-suite-flake/flake.nix
T
FUFSoB fdb2b08790 refactor: overhaul of options and features
Includes, but not limited to:
- zapret2 support
- declarative inbounds
- proxy-ctl revamp
- automatic proxy learning
2026-09-13 22:37:45 +05:00

143 lines
4.2 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
description = "NixOS proxy suite - SingBox, XRay, AmneziaWG 3.1, zapret, tg-ws-proxy";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
zapret = {
url = "github:kartavkun/zapret-discord-youtube";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
zapret,
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAll = nixpkgs.lib.genAttrs systems;
pkgsFor = system: import nixpkgs { inherit system; };
proxySuiteModule = import ./modules/proxy-suite { inherit zapret nixpkgs; };
mkOptionsDoc = import ./nix/options-doc.nix {
inherit nixpkgs pkgsFor proxySuiteModule;
};
mkReadmeDoc = import ./nix/readme-doc.nix {
inherit
nixpkgs
pkgsFor
proxySuiteModule
zapret
;
};
in
{
# Main module – bakes in the zapret flake so consumers don't need it as a separate input.
nixosModules.default = proxySuiteModule;
# Re-export zapret standalone for users who want just that.
nixosModules.zapret = zapret.nixosModules.default;
overlays.default = final: prev: {
inherit (import ./pkgs/default.nix { pkgs = final; })
amneziawg-tools
amneziawg-go
mkProxyCtl
mkProxySuiteTray
mkTgWsProxy
tg-ws-proxy
proxy-suite-tray
zapret2
;
};
packages = forAll (
system:
let
pkgs = pkgsFor system;
suitePkgs = import ./pkgs/default.nix { inherit pkgs; };
updateDocs = pkgs.writeShellApplication {
name = "update-docs";
runtimeInputs = [
pkgs.coreutils
pkgs.git
pkgs.nix
];
text = ''
set -euo pipefail
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "''${repo_root}" || ! -f "''${repo_root}/flake.nix" ]]; then
echo "run this helper from inside the proxy-suite-flake repository" >&2
exit 1
fi
options_output_path="$(nix build --no-link --print-out-paths "''${repo_root}#optionsDoc")"
readme_output_path="$(nix build --no-link --print-out-paths "''${repo_root}#readmeDoc")"
mkdir -p "''${repo_root}/docs"
rm -rf "''${repo_root}/docs/options"
cp -r --no-preserve=mode,ownership "''${options_output_path}" "''${repo_root}/docs/options"
install -Dm644 "''${readme_output_path}" "''${repo_root}/README.md"
echo "updated ''${repo_root}/docs/options/"
echo "updated ''${repo_root}/README.md"
'';
};
in
{
inherit (suitePkgs)
amneziawg-tools
amneziawg-go
tg-ws-proxy
proxy-suite-tray
zapret2
;
xray = import ./pkgs/xray.nix { inherit pkgs; };
optionsDoc = mkOptionsDoc system;
readmeDoc = mkReadmeDoc system;
update-docs = updateDocs;
update-options-doc = pkgs.writeShellApplication {
name = "update-options-doc";
runtimeInputs = [ updateDocs ];
text = ''
exec ${updateDocs}/bin/update-docs "$@"
'';
};
}
);
apps = forAll (system: {
update-docs = {
type = "app";
program = "${self.packages.${system}.update-docs}/bin/update-docs";
meta.description = "Update generated docs and README help from current NixOS module outputs";
};
update-options-doc = {
type = "app";
program = "${self.packages.${system}.update-options-doc}/bin/update-options-doc";
meta.description = "Compatibility alias for update-docs";
};
});
checks = forAll (
system:
import ./nix/checks.nix {
inherit
system
nixpkgs
proxySuiteModule
zapret
;
generatedOptionsDoc = mkOptionsDoc system;
generatedReadmeDoc = mkReadmeDoc system;
}
);
};
}