docs: improve some parts
This commit is contained in:
34 files changed
+932
-123
No files matched your search
@@ -37,16 +37,6 @@ inputs.proxy-suite.url = "github:FUFSoB/proxy-suite-flake";
|
|||||||
modules = [ inputs.proxy-suite.nixosModules.default ];
|
modules = [ inputs.proxy-suite.nixosModules.default ];
|
||||||
```
|
```
|
||||||
|
|
||||||
Other hosts take the same options through their own module:
|
|
||||||
|
|
||||||
| Module | For |
|
|
||||||
|---|---|
|
|
||||||
| `nixosModules.default` | NixOS |
|
|
||||||
| `nixosModules.server` | a single-user VPS: VLESS REALITY, TLS and WS inbounds, ACME and SSH |
|
|
||||||
| `systemManagerModules.default` | other distributions, via [system-manager](https://github.com/numtide/system-manager); firewall and kernel modules are left to the host |
|
|
||||||
| `homeManagerModules.default` | home-manager, without root: the local proxy, inbounds on ports from 1024, and anything else that needs no root |
|
|
||||||
| `nixOnDroidModules.default` | Android, via Nix-on-Droid: what home-manager gets, without the GUI |
|
|
||||||
|
|
||||||
A starter config:
|
A starter config:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
@@ -99,7 +89,6 @@ services.proxy-suite = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Registers a WARP device on first start.
|
|
||||||
warp = {
|
warp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
asOutbound = "singBox"; # outbound tagged "warp"
|
asOutbound = "singBox"; # outbound tagged "warp"
|
||||||
@@ -123,8 +112,8 @@ services.proxy-suite = {
|
|||||||
# the joiner here is an outbound tagged "wl".
|
# the joiner here is an outbound tagged "wl".
|
||||||
whitelistBypass = {
|
whitelistBypass = {
|
||||||
enable = true;
|
enable = true;
|
||||||
joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; };
|
creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; };
|
||||||
# creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; };
|
# joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ Whether to enable AmneziaWG client profiles\.
|
|||||||
AWG 3\.1 kernel module package\. ` null `: userspace only\.
|
AWG 3\.1 kernel module package\. ` null `: userspace only\.
|
||||||
|
|
||||||
**Type:** null or package\
|
**Type:** null or package\
|
||||||
**Default:** `<derivation amneziawg-3.1.20260828>`
|
**Default:** ` amneziawg ` from ` boot.kernelPackages ` on NixOS, ` null ` elsewhere
|
||||||
|
|
||||||
<a id="services-proxy-suite-amneziawg-profiles"></a>
|
<a id="services-proxy-suite-amneziawg-profiles"></a>
|
||||||
## services\.proxy-suite\.amneziaWg\.profiles
|
## services\.proxy-suite\.amneziaWg\.profiles
|
||||||
@@ -152,7 +152,7 @@ host:port (IPv6 in brackets) that replaces the first peer’s endpoint\.
|
|||||||
Interface name, at most 15 characters\.
|
Interface name, at most 15 characters\.
|
||||||
|
|
||||||
**Type:** string matching the pattern ^\[A-Za-z0-9_\.-]{1,15}$\
|
**Type:** string matching the pattern ^\[A-Za-z0-9_\.-]{1,15}$\
|
||||||
**Default:** `"awg-‹name›"`
|
**Default:** `"awg-<name>"`
|
||||||
|
|
||||||
<a id="services-proxy-suite-amneziawg-profiles-name-settings"></a>
|
<a id="services-proxy-suite-amneziawg-profiles-name-settings"></a>
|
||||||
## services\.proxy-suite\.amneziaWg\.profiles\.\<name>\.settings
|
## services\.proxy-suite\.amneziaWg\.profiles\.\<name>\.settings
|
||||||
@@ -542,7 +542,7 @@ File with a vpn:// export\.
|
|||||||
AWG 3\.1 package with ` awg ` and ` awg-quick `\.
|
AWG 3\.1 package with ` awg ` and ` awg-quick `\.
|
||||||
|
|
||||||
**Type:** package\
|
**Type:** package\
|
||||||
**Default:** `<derivation amneziawg-tools-3.1.20260812>`
|
**Default:** proxy-suite’s patched ` amneziawg-tools ` (` pkgs/amneziawg.nix `)
|
||||||
|
|
||||||
<a id="services-proxy-suite-amneziawg-userspacepackage"></a>
|
<a id="services-proxy-suite-amneziawg-userspacepackage"></a>
|
||||||
## services\.proxy-suite\.amneziaWg\.userspacePackage
|
## services\.proxy-suite\.amneziaWg\.userspacePackage
|
||||||
@@ -550,7 +550,7 @@ AWG 3\.1 package with ` awg ` and ` awg-quick `\.
|
|||||||
AWG 3\.1 userspace implementation, used when the kernel module is unavailable\.
|
AWG 3\.1 userspace implementation, used when the kernel module is unavailable\.
|
||||||
|
|
||||||
**Type:** package\
|
**Type:** package\
|
||||||
**Default:** `<derivation amneziawg-go-3.1.20260828>`
|
**Default:** proxy-suite’s patched ` amneziawg-go ` (` pkgs/amneziawg.nix `)
|
||||||
|
|
||||||
<a id="services-proxy-suite-amneziawg-wireproxypackage"></a>
|
<a id="services-proxy-suite-amneziawg-wireproxypackage"></a>
|
||||||
## services\.proxy-suite\.amneziaWg\.wireproxyPackage
|
## services\.proxy-suite\.amneziaWg\.wireproxyPackage
|
||||||
@@ -558,4 +558,4 @@ AWG 3\.1 userspace implementation, used when the kernel module is unavailable\.
|
|||||||
wireproxy build with AWG 3\.1, used by profiles with ` asOutbound = "userspace" `\.
|
wireproxy build with AWG 3\.1, used by profiles with ` asOutbound = "userspace" `\.
|
||||||
|
|
||||||
**Type:** package\
|
**Type:** package\
|
||||||
**Default:** `<derivation wireproxy-awg-1.0.18>`
|
**Default:** proxy-suite’s ` wireproxy-awg ` (` pkgs/wireproxy-awg.nix `)
|
||||||
@@ -41,11 +41,11 @@ Whether to enable proxy-suite\.
|
|||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
amneziaWg = {
|
amneziaWg = {
|
||||||
enable = false;
|
enable = false;
|
||||||
kernelModulePackage = pkgs.amneziawg;
|
kernelModulePackage = ‹amneziawg from boot.kernelPackages on NixOS, null elsewhere›;
|
||||||
profiles = { };
|
profiles = { };
|
||||||
toolsPackage = pkgs.amneziawg-tools;
|
toolsPackage = ‹proxy-suite's patched amneziawg-tools (pkgs/amneziawg.nix)›;
|
||||||
userspacePackage = pkgs.amneziawg-go;
|
userspacePackage = ‹proxy-suite's patched amneziawg-go (pkgs/amneziawg.nix)›;
|
||||||
wireproxyPackage = pkgs.wireproxy-awg;
|
wireproxyPackage = ‹proxy-suite's wireproxy-awg (pkgs/wireproxy-awg.nix)›;
|
||||||
};
|
};
|
||||||
enable = false;
|
enable = false;
|
||||||
geodata = {
|
geodata = {
|
||||||
@@ -66,7 +66,7 @@ services.proxy-suite = {
|
|||||||
enable = false;
|
enable = false;
|
||||||
listeners = { };
|
listeners = { };
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
package = pkgs.xray;
|
package = ‹proxy-suite's xray (pkgs/xray.nix)›;
|
||||||
routing = {
|
routing = {
|
||||||
blockPrivate = true;
|
blockPrivate = true;
|
||||||
blockRu = true;
|
blockRu = true;
|
||||||
@@ -160,7 +160,7 @@ services.proxy-suite = {
|
|||||||
strategy = null;
|
strategy = null;
|
||||||
};
|
};
|
||||||
enable = false;
|
enable = false;
|
||||||
ipv6 = true;
|
ipv6 = config.networking.enableIPv6;
|
||||||
listener = {
|
listener = {
|
||||||
address = "127.0.0.1";
|
address = "127.0.0.1";
|
||||||
auth = {
|
auth = {
|
||||||
@@ -203,7 +203,7 @@ services.proxy-suite = {
|
|||||||
selectionExclude = [ ];
|
selectionExclude = [ ];
|
||||||
singBox = {
|
singBox = {
|
||||||
clashApiPort = 9090;
|
clashApiPort = 9090;
|
||||||
package = pkgs.sing-box;
|
package = ‹sing-box from proxy-suite's own nixpkgs input›;
|
||||||
};
|
};
|
||||||
subscriptionUpdateInterval = "1d";
|
subscriptionUpdateInterval = "1d";
|
||||||
subscriptions = [ ];
|
subscriptions = [ ];
|
||||||
@@ -230,7 +230,7 @@ services.proxy-suite = {
|
|||||||
url = "https://www.gstatic.com/generate_204";
|
url = "https://www.gstatic.com/generate_204";
|
||||||
};
|
};
|
||||||
xray = {
|
xray = {
|
||||||
package = pkgs.xray;
|
package = ‹proxy-suite's xray (pkgs/xray.nix)›;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sshProxy = {
|
sshProxy = {
|
||||||
@@ -322,7 +322,7 @@ services.proxy-suite = {
|
|||||||
creators = { };
|
creators = { };
|
||||||
enable = false;
|
enable = false;
|
||||||
joiners = { };
|
joiners = { };
|
||||||
package = pkgs.whitelist-bypass;
|
package = ‹proxy-suite's whitelist-bypass (pkgs/whitelist-bypass.nix)›;
|
||||||
};
|
};
|
||||||
zapret = {
|
zapret = {
|
||||||
cidrExemption = {
|
cidrExemption = {
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
backend = "sing-box"; # or "xray", "hybrid"
|
||||||
|
|
||||||
|
# `url` ends up in the Nix store; use `urlFile` for secrets.
|
||||||
|
outbounds = [ { tag = "nl-vps"; url = "hy2://password@example.com:443?sni=example.com"; } ];
|
||||||
|
subscriptions = [ { tag = "main-sub"; urlFile = "/run/secrets/sub-url"; } ];
|
||||||
|
selection = "urltest"; # pick the fastest; default "first"
|
||||||
|
|
||||||
|
tproxy.enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
perAppRouting = {
|
||||||
|
enable = true;
|
||||||
|
createDefaultProfiles = true;
|
||||||
|
proxychains.enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
tproxy.enable = true;
|
||||||
|
zapret.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
zapret.enable = true;
|
||||||
|
|
||||||
|
sshProxy = {
|
||||||
|
enable = true;
|
||||||
|
server = {
|
||||||
|
user = "root";
|
||||||
|
host = "ssh.example.com";
|
||||||
|
};
|
||||||
|
identityFile = "/run/secrets/proxy-suite-ssh-key";
|
||||||
|
hostKeyFile = "/run/secrets/proxy-suite-ssh-known-hosts";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Only one global tunnel (AWG, TUN or TProxy) runs at a time.
|
||||||
|
amneziaWg = {
|
||||||
|
enable = true;
|
||||||
|
profiles.home.configFile = "/run/secrets/home-amneziawg.conf";
|
||||||
|
profiles.work.vpnFile = "/run/secrets/work-amnezia.vpn";
|
||||||
|
# Or use a profile as an outbound, tagged "de":
|
||||||
|
profiles.de = {
|
||||||
|
asOutbound = "interface"; # or "userspace" (no root), "singBox" (plain WireGuard)
|
||||||
|
configFile = "/run/secrets/de-amneziawg.conf";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
warp = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = "singBox"; # outbound tagged "warp"
|
||||||
|
# asAmneziaWg = true; # or a global profile: proxy-ctl awg on warp
|
||||||
|
};
|
||||||
|
|
||||||
|
# Outbound tagged "tor"; .onion names always go there.
|
||||||
|
tor = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = true;
|
||||||
|
# bridges.file = "/run/secrets/tor-bridges";
|
||||||
|
# upstream = "proxy"; # reach Tor through the proxy
|
||||||
|
};
|
||||||
|
|
||||||
|
tgWsProxy = {
|
||||||
|
enable = true;
|
||||||
|
secretFile = "/run/secrets/tg-ws-proxy-secret";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tunnel through a video call. A creator runs on a free server and logs the call link;
|
||||||
|
# the joiner here is an outbound tagged "wl".
|
||||||
|
whitelistBypass = {
|
||||||
|
enable = true;
|
||||||
|
creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; };
|
||||||
|
# joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
gui.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
amneziaWg = {
|
||||||
|
enable = true;
|
||||||
|
profiles.home.configFile = "/run/secrets/home-awg.conf";
|
||||||
|
profiles.work = {
|
||||||
|
vpnFile = "/run/secrets/work-amnezia.vpn";
|
||||||
|
autostart = true; # at most one profile
|
||||||
|
};
|
||||||
|
};
|
||||||
|
killSwitch.enable = true; # optional: no leaks while the tunnel is down
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy.enable = true;
|
||||||
|
amneziaWg = {
|
||||||
|
enable = true;
|
||||||
|
profiles.de = {
|
||||||
|
configFile = "/run/secrets/de-awg.conf";
|
||||||
|
asOutbound = "interface";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [
|
||||||
|
{ tag = "hop"; urlFile = "/run/secrets/hop-url"; }
|
||||||
|
{ tag = "de-vps"; urlFile = "/run/secrets/de-vps-url"; detour = "hop"; }
|
||||||
|
];
|
||||||
|
selectionExclude = [ "hop" ]; # never picked as the exit on its own
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
routing.rules = [
|
||||||
|
{ domains = [ "chatgpt.com" "openai.com" ]; outbound = "warp"; }
|
||||||
|
{ domains = [ "check.torproject.org" ]; outbound = "tor"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tagged "warp". Registers a free WARP device on first start.
|
||||||
|
warp = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = "singBox";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tagged "tor". .onion names always go to it.
|
||||||
|
tor = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tagged "ssh-proxy".
|
||||||
|
sshProxy = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = true;
|
||||||
|
server = { user = "me"; host = "ssh.example.com"; };
|
||||||
|
identityFile = "/run/secrets/ssh-key";
|
||||||
|
hostKeyFile = "/run/secrets/ssh-known-hosts"; # from ssh-keyscan
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
subscriptions = [ { tag = "provider"; urlFile = "/run/secrets/provider-sub-url"; } ];
|
||||||
|
selection = "urltest";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
};
|
||||||
|
gui.enable = true;
|
||||||
|
userControl = {
|
||||||
|
enable = true;
|
||||||
|
scopes = [ "services" "routing" "outbounds" "perApp" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
users.users.alice.extraGroups = [ "proxy-suite" ];
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
# Telegram apps dial their data centres by IP, so names alone do not catch them
|
||||||
|
# (https://core.telegram.org/resources/cidr.txt).
|
||||||
|
telegramIps = [
|
||||||
|
"91.105.192.0/23"
|
||||||
|
"91.108.4.0/22"
|
||||||
|
"91.108.8.0/22"
|
||||||
|
"91.108.12.0/22"
|
||||||
|
"91.108.16.0/22"
|
||||||
|
"91.108.20.0/22"
|
||||||
|
"91.108.56.0/22"
|
||||||
|
"149.154.160.0/20"
|
||||||
|
"185.76.151.0/24"
|
||||||
|
"2001:67c:4e8::/48"
|
||||||
|
"2001:b28:f23c::/48"
|
||||||
|
"2001:b28:f23d::/48"
|
||||||
|
"2001:b28:f23f::/48"
|
||||||
|
"2a0a:f280::/32"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||||
|
|
||||||
|
routing = {
|
||||||
|
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
|
||||||
|
default = "direct";
|
||||||
|
# Russian sites are routed by the last rule below instead.
|
||||||
|
directRu = false;
|
||||||
|
|
||||||
|
# Checked in order; the first match wins.
|
||||||
|
rules = [
|
||||||
|
{
|
||||||
|
outbound = "ssh-proxy";
|
||||||
|
geosites = [ "pixiv" "twitter" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
outbound = "warp";
|
||||||
|
geosites = [ "youtube" ];
|
||||||
|
}
|
||||||
|
# To mask your IP from Russian services
|
||||||
|
{
|
||||||
|
outbound = "warp";
|
||||||
|
geosites = [ "category-ru" ];
|
||||||
|
geoips = [ "ru" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# Through the selected outbound ("primary").
|
||||||
|
proxy = {
|
||||||
|
geosites = [ "openai" "anthropic" "telegram" "netflix" ];
|
||||||
|
ips = telegramIps;
|
||||||
|
# WARP registers through the proxy: its API is blocked directly in Russia.
|
||||||
|
domains = [ "api.cloudflareclient.com" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it
|
||||||
|
# is kept out of the probes.
|
||||||
|
autoProxy = {
|
||||||
|
enable = true;
|
||||||
|
exclude = [ "googlevideo.com" "gvt1.com" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
warp = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = "singBox";
|
||||||
|
};
|
||||||
|
|
||||||
|
sshProxy = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = true;
|
||||||
|
server = {
|
||||||
|
user = "me";
|
||||||
|
host = "203.0.113.20";
|
||||||
|
port = 2222;
|
||||||
|
};
|
||||||
|
identityFile = "/run/secrets/proxy-ssh-key";
|
||||||
|
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tor through the proxy, since this network blocks Tor.
|
||||||
|
tor = {
|
||||||
|
enable = true;
|
||||||
|
asOutbound = true;
|
||||||
|
upstream = "proxy";
|
||||||
|
};
|
||||||
|
|
||||||
|
zapret = {
|
||||||
|
enable = true;
|
||||||
|
engine = "zapret2";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
interface = "awg0";
|
||||||
|
serverAddress = "10.77.77.1";
|
||||||
|
privateDomains = [ "mail.example.com" ];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||||
|
};
|
||||||
|
|
||||||
|
inbounds = {
|
||||||
|
enable = true;
|
||||||
|
routing.via = "proxy";
|
||||||
|
listeners.vpn = {
|
||||||
|
type = "amneziawg";
|
||||||
|
port = 51820;
|
||||||
|
# Fixed addresses, so firewall rules and DNS can name each device. Keys are
|
||||||
|
# generated on first start.
|
||||||
|
users = [
|
||||||
|
{ name = "laptop"; address = "10.77.77.2"; }
|
||||||
|
{ name = "phone"; address = "10.77.77.3"; }
|
||||||
|
];
|
||||||
|
amneziaWg = {
|
||||||
|
# Devices also reach this host, its LAN and each other, directly.
|
||||||
|
mode = "lan";
|
||||||
|
interfaceName = interface;
|
||||||
|
subnet = "10.77.77.0/24";
|
||||||
|
subnet6 = "fd77:77:77::/64";
|
||||||
|
mtu = 1400;
|
||||||
|
dns = [ serverAddress ];
|
||||||
|
# Optional: a fixed server key, so client configs survive a reinstall.
|
||||||
|
privateKeyFile = "/run/secrets/awg-server-key";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Private names for VPN clients; everything else is forwarded to 1.1.1.1.
|
||||||
|
services.dnsmasq = {
|
||||||
|
enable = true;
|
||||||
|
resolveLocalQueries = false;
|
||||||
|
settings = {
|
||||||
|
bind-dynamic = true;
|
||||||
|
interface = interface;
|
||||||
|
listen-address = serverAddress;
|
||||||
|
no-resolv = true;
|
||||||
|
server = [ "1.1.1.1" ];
|
||||||
|
address = map (domain: "/${domain}/${serverAddress}") privateDomains;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# The interface comes and goes with the listener.
|
||||||
|
systemd.services.dnsmasq = {
|
||||||
|
after = [ "proxy-suite-inbounds-awg.service" ];
|
||||||
|
wants = [ "proxy-suite-inbounds-awg.service" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
domain = "vpn.example.com";
|
||||||
|
certDir = config.security.acme.certs.${domain}.directory;
|
||||||
|
|
||||||
|
users = map (name: { inherit name; uuidFile = "/run/secrets/proxy-uuid-${name}"; }) [
|
||||||
|
"alice"
|
||||||
|
"bob"
|
||||||
|
"carol"
|
||||||
|
];
|
||||||
|
|
||||||
|
# The listeners terminate TLS themselves, so share links honestly say security=tls.
|
||||||
|
tls = {
|
||||||
|
enable = true;
|
||||||
|
certificateFile = "${certDir}/fullchain.pem";
|
||||||
|
keyFile = "${certDir}/key.pem";
|
||||||
|
serverName = domain;
|
||||||
|
};
|
||||||
|
|
||||||
|
# nginx on 443 hands a path to a loopback listener.
|
||||||
|
fronted = port: path: extra: {
|
||||||
|
type = "vless";
|
||||||
|
inherit port users;
|
||||||
|
address = "127.0.0.1";
|
||||||
|
sharePort = 443; # share links name nginx's port, not the listener's
|
||||||
|
transport = extra // {
|
||||||
|
inherit path;
|
||||||
|
# nginx sets this header, so XRay sees each client's real address (for
|
||||||
|
# `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
|
||||||
|
trustedXForwardedFor = [ "X-Real-IP" ];
|
||||||
|
};
|
||||||
|
inherit tls;
|
||||||
|
};
|
||||||
|
location = port: extra: {
|
||||||
|
proxyPass = "https://127.0.0.1:${toString port}";
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
proxy_ssl_name ${domain};
|
||||||
|
# Tunnels idle along with their users; the 60s default would cut them.
|
||||||
|
proxy_read_timeout 3600s;
|
||||||
|
proxy_send_timeout 3600s;
|
||||||
|
''
|
||||||
|
+ extra;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||||
|
};
|
||||||
|
|
||||||
|
inbounds = {
|
||||||
|
enable = true;
|
||||||
|
serverAddress = domain;
|
||||||
|
routing.via = "proxy";
|
||||||
|
|
||||||
|
listeners = {
|
||||||
|
# nginx speaks HTTP/1.1 to the listener, which only packet-up mode crosses.
|
||||||
|
xhttp = fronted 10003 "/media" {
|
||||||
|
type = "xhttp";
|
||||||
|
mode = "packet-up";
|
||||||
|
};
|
||||||
|
ws = fronted 10002 "/media-ws" { type = "ws"; };
|
||||||
|
# stream-one needs HTTP/2 all the way: nginx's grpc_pass provides it.
|
||||||
|
xhttp-stream = lib.recursiveUpdate (fronted 10004 "/media-stream" {
|
||||||
|
type = "xhttp";
|
||||||
|
mode = "stream-one";
|
||||||
|
}) { tls.alpn = [ "h2" ]; };
|
||||||
|
|
||||||
|
# HTTP/3 takes UDP 443 only, beside nginx on TCP 443. No trustedXForwardedFor:
|
||||||
|
# nothing is in front, so it already sees the real client.
|
||||||
|
xhttp-h3 = {
|
||||||
|
type = "vless";
|
||||||
|
port = 443;
|
||||||
|
inherit users;
|
||||||
|
transport = { type = "xhttp"; path = "/media-h3"; };
|
||||||
|
tls = tls // { alpn = [ "h3" ]; };
|
||||||
|
};
|
||||||
|
|
||||||
|
reality = {
|
||||||
|
type = "vless";
|
||||||
|
port = 2053;
|
||||||
|
inherit users;
|
||||||
|
flow = "xtls-rprx-vision";
|
||||||
|
reality = {
|
||||||
|
enable = true;
|
||||||
|
# Probes without the key land on a real TLS 1.3 + HTTP/2 site.
|
||||||
|
dest = "www.samsung.com:443";
|
||||||
|
serverNames = [ "www.samsung.com" ];
|
||||||
|
privateKeyFile = "/run/secrets/proxy-reality-key";
|
||||||
|
publicKey = "jNXH…";
|
||||||
|
shortIds = [ "0123abcd" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
subscriptions = {
|
||||||
|
enable = true;
|
||||||
|
baseUrl = "https://${domain}/sub";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
userControl.enable = true; # passwordless proxy-ctl for the admin, see below
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.admin.extraGroups = [ "proxy-suite" ];
|
||||||
|
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults.email = "admin@example.com";
|
||||||
|
# A renewed certificate restarts the listeners.
|
||||||
|
certs.${domain}.reloadServices = [ "proxy-suite-inbounds.service" ];
|
||||||
|
};
|
||||||
|
systemd.services.proxy-suite-inbounds = {
|
||||||
|
wants = [ "acme-${domain}.service" ];
|
||||||
|
after = [ "acme-${domain}.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts.${domain} = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
locations = {
|
||||||
|
# A prefix match: XHTTP appends /<session>/<seq>.
|
||||||
|
"/media" = location 10003 ''
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_request_buffering off;
|
||||||
|
proxy_buffering off;
|
||||||
|
client_max_body_size 0;
|
||||||
|
'';
|
||||||
|
"= /media-ws" = location 10002 "" // { proxyWebsockets = true; };
|
||||||
|
"/media-stream".extraConfig = ''
|
||||||
|
grpc_pass grpcs://127.0.0.1:10004;
|
||||||
|
grpc_set_header X-Forwarded-For $remote_addr;
|
||||||
|
grpc_set_header X-Real-IP $remote_addr;
|
||||||
|
grpc_ssl_server_name on;
|
||||||
|
grpc_ssl_name ${domain};
|
||||||
|
grpc_read_timeout 3600s;
|
||||||
|
grpc_send_timeout 3600s;
|
||||||
|
client_max_body_size 0;
|
||||||
|
'';
|
||||||
|
# Subscriptions. Some clients show profile-title and follow profile-update-interval.
|
||||||
|
"/sub/".extraConfig = ''
|
||||||
|
alias /run/proxy-suite-inbounds/subscriptions/;
|
||||||
|
default_type text/plain;
|
||||||
|
autoindex off;
|
||||||
|
add_header profile-title "My VPN" always;
|
||||||
|
add_header profile-update-interval "12" always;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
proxySuite = config.lib.proxy-suite;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
# The server's subscription: every listener, each a separate outbound.
|
||||||
|
subscriptions = [ { tag = "home"; urlFile = "/run/secrets/proxy-home-sub"; } ];
|
||||||
|
# The fastest listener that gets through the current network.
|
||||||
|
selection = "urltest";
|
||||||
|
urlTest.url = "https://telegram.org"; # blocked here, so a pass means it works
|
||||||
|
|
||||||
|
routing.default = "direct";
|
||||||
|
autoProxy.enable = true;
|
||||||
|
tun.enable = true; # when everything should go through: proxy-ctl proxy tun on
|
||||||
|
};
|
||||||
|
|
||||||
|
zapret = {
|
||||||
|
enable = true;
|
||||||
|
engine = "zapret2";
|
||||||
|
};
|
||||||
|
|
||||||
|
# The private VPN: `proxy-ctl awg on home`.
|
||||||
|
amneziaWg = {
|
||||||
|
enable = true;
|
||||||
|
profiles.home.configFile = "/run/secrets/home-vpn.conf";
|
||||||
|
};
|
||||||
|
killSwitch.enable = true;
|
||||||
|
|
||||||
|
perAppRouting = {
|
||||||
|
enable = true;
|
||||||
|
createDefaultProfiles = true;
|
||||||
|
proxychains.enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
gui.enable = true;
|
||||||
|
userControl.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.me.extraGroups = [ "proxy-suite" ];
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
# CLIs that only work through the proxy, whatever the routing says.
|
||||||
|
(proxySuite.wrapEnv { protocol = "all"; } pkgs.codex)
|
||||||
|
(proxySuite.wrapEnv { } pkgs.claude-code)
|
||||||
|
# A browser for blocked sites, with its UDP (QUIC) too.
|
||||||
|
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.chromium)
|
||||||
|
];
|
||||||
|
|
||||||
|
# Nix downloads through the proxy.
|
||||||
|
systemd.services.nix-daemon.environment = proxySuite.envFor "http";
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
};
|
||||||
|
perAppRouting = {
|
||||||
|
enable = true;
|
||||||
|
createDefaultProfiles = true; # a profile named after each method below
|
||||||
|
proxychains.enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
};
|
||||||
|
perAppRouting = {
|
||||||
|
enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
profiles = [ { name = "browser"; route = "tun"; } ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
routing = {
|
||||||
|
default = "direct";
|
||||||
|
proxy.domains = [ "youtube.com" "googlevideo.com" ];
|
||||||
|
proxy.geosites = [ "instagram" ];
|
||||||
|
};
|
||||||
|
# Find blocked sites on its own, and route each one through an exit that reaches it.
|
||||||
|
autoProxy.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [
|
||||||
|
{ tag = "nl-vps"; urlFile = "/run/secrets/nl-vps-url"; }
|
||||||
|
{ tag = "us-vps"; urlFile = "/run/secrets/us-vps-url"; }
|
||||||
|
];
|
||||||
|
routing = {
|
||||||
|
rules = [ { geosites = [ "netflix" ]; outbound = "us-vps"; } ];
|
||||||
|
direct.domains = [ "bank.example" ];
|
||||||
|
block.geosites = [ "category-ads-all" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
routing = {
|
||||||
|
default = "direct";
|
||||||
|
ruleSets.blocked.url = "https://example.com/blocked.srs";
|
||||||
|
proxy.ruleSets = [ "blocked" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
inbounds = {
|
||||||
|
enable = true;
|
||||||
|
serverAddress = "vpn.example.com"; # null: this host's public IPv4
|
||||||
|
routing.via = "direct"; # clients exit straight from this host
|
||||||
|
listeners = {
|
||||||
|
vless-reality = {
|
||||||
|
type = "vless";
|
||||||
|
port = 443;
|
||||||
|
flow = "xtls-rprx-vision";
|
||||||
|
users = [
|
||||||
|
{ name = "phone"; uuidFile = "/run/secrets/uuid-phone"; }
|
||||||
|
{ name = "laptop"; uuidFile = "/run/secrets/uuid-laptop"; }
|
||||||
|
];
|
||||||
|
reality = {
|
||||||
|
enable = true;
|
||||||
|
serverNames = [ "www.microsoft.com" ];
|
||||||
|
privateKeyFile = "/run/secrets/reality-private-key";
|
||||||
|
publicKey = "jNXH…"; # from the same `xray x25519` run
|
||||||
|
shortIds = [ "0123abcd" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# Keys for the server and each user are generated on first start.
|
||||||
|
awg = {
|
||||||
|
type = "amneziawg";
|
||||||
|
port = 51820;
|
||||||
|
users = [ { name = "phone"; } ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite.inbounds.subscriptions = {
|
||||||
|
enable = true;
|
||||||
|
baseUrl = "https://vpn.example.com/sub";
|
||||||
|
};
|
||||||
|
services.nginx.virtualHosts."vpn.example.com".locations."/sub/".alias =
|
||||||
|
"/run/proxy-suite-inbounds/subscriptions/";
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
tun.enable = true;
|
||||||
|
autostart = "tun"; # or null, to start it by hand
|
||||||
|
};
|
||||||
|
killSwitch.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
whitelistBypass = {
|
||||||
|
enable = true;
|
||||||
|
creators.laptop = {
|
||||||
|
platform = "wbstream";
|
||||||
|
cookiesFile = "/run/secrets/wbstream-cookies.json";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy.enable = true;
|
||||||
|
whitelistBypass = {
|
||||||
|
enable = true;
|
||||||
|
joiners.wl.platform = "wbstream";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
proxySuite = config.lib.proxy-suite;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
proxy = {
|
||||||
|
enable = true;
|
||||||
|
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||||
|
};
|
||||||
|
perAppRouting = {
|
||||||
|
enable = true;
|
||||||
|
createDefaultProfiles = true;
|
||||||
|
proxychains.enable = true;
|
||||||
|
tun.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
(proxySuite.wrapEnv { } pkgs.yt-dlp)
|
||||||
|
(proxySuite.wrapProxychains { } pkgs.telegram-desktop)
|
||||||
|
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.firefox)
|
||||||
|
];
|
||||||
|
|
||||||
|
# A service: here nix-daemon, so downloads go through the proxy.
|
||||||
|
systemd.services.nix-daemon.environment = proxySuite.envFor "http";
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
zapret = {
|
||||||
|
enable = true;
|
||||||
|
zapret-discord-youtube = {
|
||||||
|
configName = "general(ALT)"; # the default; try others if it does not work
|
||||||
|
domains = [ "rutracker.org" ]; # more sites to unblock
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.proxy-suite = {
|
||||||
|
enable = true;
|
||||||
|
zapret = {
|
||||||
|
enable = true;
|
||||||
|
engine = "zapret2";
|
||||||
|
zapret2.domains = [ "rutracker.org" ]; # always treated as blocked
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -7,14 +7,6 @@ listed. Everything runs in global TUN mode, so every app on the host follows the
|
|||||||
```nix
|
```nix
|
||||||
{ ... }:
|
{ ... }:
|
||||||
let
|
let
|
||||||
# Geosite "youtube" can miss the video and API hosts.
|
|
||||||
youtubeDomains = [
|
|
||||||
"googlevideo.com"
|
|
||||||
"gvt1.com"
|
|
||||||
"ytimg.com"
|
|
||||||
"ggpht.com"
|
|
||||||
"youtubei.googleapis.com"
|
|
||||||
];
|
|
||||||
# Telegram apps dial their data centres by IP, so names alone do not catch them
|
# Telegram apps dial their data centres by IP, so names alone do not catch them
|
||||||
# (https://core.telegram.org/resources/cidr.txt).
|
# (https://core.telegram.org/resources/cidr.txt).
|
||||||
telegramIps = [
|
telegramIps = [
|
||||||
@@ -41,8 +33,6 @@ in
|
|||||||
proxy = {
|
proxy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||||
tun.enable = true;
|
|
||||||
autostart = "tun";
|
|
||||||
|
|
||||||
routing = {
|
routing = {
|
||||||
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
|
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
|
||||||
@@ -52,24 +42,15 @@ in
|
|||||||
|
|
||||||
# Checked in order; the first match wins.
|
# Checked in order; the first match wins.
|
||||||
rules = [
|
rules = [
|
||||||
# Sites that reject both this host's and the VPS's networks.
|
|
||||||
{
|
{
|
||||||
outbound = "ssh-proxy";
|
outbound = "ssh-proxy";
|
||||||
geosites = [ "pixiv" "twitter" ];
|
geosites = [ "pixiv" "twitter" ];
|
||||||
}
|
}
|
||||||
# Video throttled per connection by destination IP, which zapret cannot fix.
|
|
||||||
# One exit for the whole session: video URLs are bound to the IP that asked.
|
|
||||||
{
|
{
|
||||||
outbound = "warp";
|
outbound = "warp";
|
||||||
domains = youtubeDomains;
|
|
||||||
geosites = [ "youtube" ];
|
geosites = [ "youtube" ];
|
||||||
}
|
}
|
||||||
# A CDN that stalls through WARP but runs at full speed directly.
|
# To mask your IP from Russian services
|
||||||
{
|
|
||||||
outbound = "direct";
|
|
||||||
domains = [ "video-cdn.example" ];
|
|
||||||
}
|
|
||||||
# Russian services that refuse the VPS's foreign IP.
|
|
||||||
{
|
{
|
||||||
outbound = "warp";
|
outbound = "warp";
|
||||||
geosites = [ "category-ru" ];
|
geosites = [ "category-ru" ];
|
||||||
@@ -81,13 +62,12 @@ in
|
|||||||
proxy = {
|
proxy = {
|
||||||
geosites = [ "openai" "anthropic" "telegram" "netflix" ];
|
geosites = [ "openai" "anthropic" "telegram" "netflix" ];
|
||||||
ips = telegramIps;
|
ips = telegramIps;
|
||||||
# WARP registers through the proxy: its API is blocked directly.
|
# WARP registers through the proxy: its API is blocked directly in Russia.
|
||||||
domains = [ "api.cloudflareclient.com" ];
|
domains = [ "api.cloudflareclient.com" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it
|
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it is kept out of the probes.
|
||||||
# is kept out of the probes.
|
|
||||||
autoProxy = {
|
autoProxy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
exclude = [ "googlevideo.com" "gvt1.com" ];
|
exclude = [ "googlevideo.com" "gvt1.com" ];
|
||||||
@@ -111,27 +91,11 @@ in
|
|||||||
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
|
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Tor through the proxy, since this network blocks Tor.
|
|
||||||
tor = {
|
|
||||||
enable = true;
|
|
||||||
asOutbound = true;
|
|
||||||
upstream = "proxy";
|
|
||||||
};
|
|
||||||
|
|
||||||
zapret = {
|
zapret = {
|
||||||
enable = true;
|
enable = true;
|
||||||
engine = "zapret2";
|
engine = "zapret2";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# autoProxy probes in bursts (seconds of CPU, a few hundred MB). On a busy host, keep
|
|
||||||
# it from competing with real work.
|
|
||||||
systemd.services.proxy-suite-autoproxy.serviceConfig = {
|
|
||||||
CPUWeight = 10;
|
|
||||||
IOWeight = 10;
|
|
||||||
Nice = 19;
|
|
||||||
MemoryHigh = "200M";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -107,8 +107,14 @@
|
|||||||
mkProxySuiteTray = throw "mkProxySuiteTray was replaced by Proxy Suite GUI: set services.proxy-suite.gui.enable";
|
mkProxySuiteTray = throw "mkProxySuiteTray was replaced by Proxy Suite GUI: set services.proxy-suite.gui.enable";
|
||||||
};
|
};
|
||||||
|
|
||||||
# `nix fmt`; the nix-format check holds the tree to it.
|
# `nix fmt`; the nix-format check holds the tree to it. The usage snippets are
|
||||||
formatter = forAll (system: (pkgsFor system).nixfmt-tree);
|
# generated, and the usage-docs check wants them as their Markdown has them.
|
||||||
|
formatter = forAll (
|
||||||
|
system:
|
||||||
|
(pkgsFor system).nixfmt-tree.override {
|
||||||
|
settings.global.excludes = [ "docs/usage/.snippets/*" ];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
packages = forAll (
|
packages = forAll (
|
||||||
system:
|
system:
|
||||||
@@ -140,8 +146,14 @@
|
|||||||
cp -r --no-preserve=mode,ownership "''${options_output_path}" "''${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"
|
install -Dm644 "''${readme_output_path}" "''${repo_root}/README.md"
|
||||||
|
|
||||||
|
# After the README, whose blocks are among them.
|
||||||
|
snippets_output_path="$(nix build --no-link --print-out-paths "''${repo_root}#usageSnippets")"
|
||||||
|
rm -rf "''${repo_root}/docs/usage/.snippets"
|
||||||
|
cp -r --no-preserve=mode,ownership "''${snippets_output_path}" "''${repo_root}/docs/usage/.snippets"
|
||||||
|
|
||||||
echo "updated ''${repo_root}/docs/options/"
|
echo "updated ''${repo_root}/docs/options/"
|
||||||
echo "updated ''${repo_root}/README.md"
|
echo "updated ''${repo_root}/README.md"
|
||||||
|
echo "updated ''${repo_root}/docs/usage/.snippets/"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -167,6 +179,14 @@
|
|||||||
];
|
];
|
||||||
}).config.system.build.isoImage;
|
}).config.system.build.isoImage;
|
||||||
optionsDoc = mkOptionsDoc system;
|
optionsDoc = mkOptionsDoc system;
|
||||||
|
usageSnippets = pkgs.runCommand "proxy-suite-usage-snippets" { } (
|
||||||
|
''
|
||||||
|
mkdir "$out"
|
||||||
|
''
|
||||||
|
+ pkgs.lib.concatMapStrings (snippet: ''
|
||||||
|
cp ${pkgs.writeText snippet.file snippet.text} "$out"/${snippet.file}
|
||||||
|
'') (import ./nix/usage-snippets.nix { inherit (pkgs) lib; }).snippets
|
||||||
|
);
|
||||||
readmeDoc = mkReadmeDoc system;
|
readmeDoc = mkReadmeDoc system;
|
||||||
update-docs = updateDocs;
|
update-docs = updateDocs;
|
||||||
update-options-doc = pkgs.writeShellApplication {
|
update-options-doc = pkgs.writeShellApplication {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
|
literalMD
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
@@ -21,18 +22,21 @@ in
|
|||||||
toolsPackage = mkOption {
|
toolsPackage = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = awgPackages.tools;
|
default = awgPackages.tools;
|
||||||
|
defaultText = literalMD "proxy-suite's patched `amneziawg-tools` (`pkgs/amneziawg.nix`)";
|
||||||
description = "AWG 3.1 package with `awg` and `awg-quick`.";
|
description = "AWG 3.1 package with `awg` and `awg-quick`.";
|
||||||
};
|
};
|
||||||
|
|
||||||
userspacePackage = mkOption {
|
userspacePackage = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = awgPackages.userspace;
|
default = awgPackages.userspace;
|
||||||
|
defaultText = literalMD "proxy-suite's patched `amneziawg-go` (`pkgs/amneziawg.nix`)";
|
||||||
description = "AWG 3.1 userspace implementation, used when the kernel module is unavailable.";
|
description = "AWG 3.1 userspace implementation, used when the kernel module is unavailable.";
|
||||||
};
|
};
|
||||||
|
|
||||||
wireproxyPackage = mkOption {
|
wireproxyPackage = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = awgPackages.wireproxy;
|
default = awgPackages.wireproxy;
|
||||||
|
defaultText = literalMD "proxy-suite's `wireproxy-awg` (`pkgs/wireproxy-awg.nix`)";
|
||||||
description = "wireproxy build with AWG 3.1, used by profiles with `asOutbound = \"userspace\"`.";
|
description = "wireproxy build with AWG 3.1, used by profiles with `asOutbound = \"userspace\"`.";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -43,6 +47,7 @@ in
|
|||||||
kernelPackages = config.services.proxy-suite.host.kernelPackages;
|
kernelPackages = config.services.proxy-suite.host.kernelPackages;
|
||||||
in
|
in
|
||||||
if kernelPackages == null then null else awgPackages.kernelModule kernelPackages;
|
if kernelPackages == null then null else awgPackages.kernelModule kernelPackages;
|
||||||
|
defaultText = literalMD "`amneziawg` from `boot.kernelPackages` on NixOS, `null` elsewhere";
|
||||||
description = "AWG 3.1 kernel module package. `null`: userspace only.";
|
description = "AWG 3.1 kernel module package. `null`: userspace only.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ let
|
|||||||
interfaceName = mkOption {
|
interfaceName = mkOption {
|
||||||
type = types.strMatching "^[A-Za-z0-9_.-]{1,15}$";
|
type = types.strMatching "^[A-Za-z0-9_.-]{1,15}$";
|
||||||
default = "awg-${name}";
|
default = "awg-${name}";
|
||||||
|
defaultText = lib.literalExpression ''"awg-<name>"'';
|
||||||
description = "Interface name, at most 15 characters.";
|
description = "Interface name, at most 15 characters.";
|
||||||
};
|
};
|
||||||
autostart = mkOption {
|
autostart = mkOption {
|
||||||
|
|||||||
+35
-50
@@ -48,6 +48,11 @@ in
|
|||||||
pkgs.runCommand "proxy-suite-options-doc-check" { nativeBuildInputs = [ pkgs.diffutils ]; }
|
pkgs.runCommand "proxy-suite-options-doc-check" { nativeBuildInputs = [ pkgs.diffutils ]; }
|
||||||
''
|
''
|
||||||
diff -ru ${../../docs/options} ${generatedOptionsDoc}
|
diff -ru ${../../docs/options} ${generatedOptionsDoc}
|
||||||
|
# A package default without defaultText renders as a store derivation.
|
||||||
|
if grep -rn '<derivation ' ${generatedOptionsDoc}; then
|
||||||
|
echo "package option without defaultText" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
touch "$out"
|
touch "$out"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@@ -60,30 +65,23 @@ in
|
|||||||
|
|
||||||
# The usage guides are hand-written; what can go stale in them is checked here. Every
|
# The usage guides are hand-written; what can go stale in them is checked here. Every
|
||||||
# ```nix block that sets services.proxy-suite (in the guides, their examples/ and the
|
# ```nix block that sets services.proxy-suite (in the guides, their examples/ and the
|
||||||
# README) must evaluate, with no proxy-suite assertion or warning; a block fenced
|
# README) must evaluate, with no proxy-suite assertion or warning, from its copy in
|
||||||
# ```nix no-check is skipped. A block is either module attributes or, when it starts
|
# docs/usage/.snippets (nix/usage-snippets.nix), which must match it. Every relative link
|
||||||
# with "{", a whole module. Every relative link must reach a file, and its #anchor an
|
# must reach a file, and its #anchor an <a id> there.
|
||||||
# <a id> there.
|
|
||||||
usage-docs =
|
usage-docs =
|
||||||
let
|
let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
usageDir = ../../docs/usage;
|
usageDir = ../../docs/usage;
|
||||||
markdownIn =
|
usageSnippets = import ../usage-snippets.nix { inherit lib; };
|
||||||
dir:
|
inherit (usageSnippets) guides snippets;
|
||||||
map (name: lib.removePrefix "./" "${dir}/${name}") (
|
|
||||||
builtins.filter (lib.hasSuffix ".md") (builtins.attrNames (builtins.readDir (usageDir + "/${dir}")))
|
|
||||||
);
|
|
||||||
guides = markdownIn "." ++ markdownIn "examples";
|
|
||||||
readmeText = builtins.readFile ../../README.md;
|
|
||||||
guideText = name: builtins.readFile (usageDir + "/${name}");
|
guideText = name: builtins.readFile (usageDir + "/${name}");
|
||||||
|
|
||||||
snippets =
|
snippetDir = ../.. + "/${usageSnippets.dir}";
|
||||||
text:
|
committed = lib.optionals (builtins.pathExists snippetDir) (
|
||||||
builtins.filter (lib.hasInfix "services.proxy-suite") (
|
builtins.attrNames (builtins.readDir snippetDir)
|
||||||
map (chunk: builtins.head (lib.splitString "\n```" chunk)) (
|
);
|
||||||
builtins.tail (lib.splitString "```nix\n" text)
|
outdated = "is out of date, run `nix run .#update-docs`";
|
||||||
)
|
|
||||||
);
|
|
||||||
# Every visible option's value, so a wrong type fails too. Packages are skipped:
|
# Every visible option's value, so a wrong type fails too. Packages are skipped:
|
||||||
# forcing one evaluates its whole build graph. Removed options throw when read.
|
# forcing one evaluates its whole build graph. Removed options throw when read.
|
||||||
plain =
|
plain =
|
||||||
@@ -102,39 +100,28 @@ in
|
|||||||
name: opt: if lib.isOption opt then plain cfg.${name} else visibleValues opt cfg.${name}
|
name: opt: if lib.isOption opt then plain cfg.${name} else visibleValues opt cfg.${name}
|
||||||
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts);
|
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts);
|
||||||
snippetProblems =
|
snippetProblems =
|
||||||
where: snippet:
|
snippet:
|
||||||
let
|
let
|
||||||
module = import (
|
path = snippetDir + "/${snippet.file}";
|
||||||
builtins.toFile "snippet.nix" (
|
|
||||||
if lib.hasPrefix "{" snippet then
|
|
||||||
snippet
|
|
||||||
else
|
|
||||||
''
|
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
{
|
|
||||||
${snippet}
|
|
||||||
}
|
|
||||||
''
|
|
||||||
)
|
|
||||||
);
|
|
||||||
eval = evalProxySuite [
|
eval = evalProxySuite [
|
||||||
module
|
(import path)
|
||||||
{ system.stateVersion = "26.05"; }
|
{ system.stateVersion = "26.05"; }
|
||||||
];
|
];
|
||||||
inherit (eval) config;
|
inherit (eval) config;
|
||||||
failed = map (a: a.message) (builtins.filter (a: !a.assertion) config.assertions);
|
failed = map (a: a.message) (builtins.filter (a: !a.assertion) config.assertions);
|
||||||
own = builtins.filter (lib.hasPrefix "proxy-suite:") (failed ++ config.warnings);
|
own = builtins.filter (lib.hasPrefix "proxy-suite:") (failed ++ config.warnings);
|
||||||
in
|
in
|
||||||
builtins.addErrorContext "while evaluating ${where}" (
|
if !builtins.elem snippet.file committed || builtins.readFile path != snippet.text then
|
||||||
builtins.deepSeq (visibleValues eval.options.services.proxy-suite config.services.proxy-suite) (
|
[ "${snippet.where}: ${usageSnippets.dir}/${snippet.file} ${outdated}" ]
|
||||||
map (message: "${where}: ${message}") own
|
else
|
||||||
)
|
builtins.addErrorContext "while evaluating ${snippet.where}" (
|
||||||
);
|
builtins.deepSeq (visibleValues eval.options.services.proxy-suite config.services.proxy-suite) (
|
||||||
textProblems =
|
map (message: "${snippet.where}: ${message}") own
|
||||||
file: text:
|
)
|
||||||
lib.concatLists (
|
);
|
||||||
lib.imap1 (index: snippetProblems "${file}, nix block ${toString index}") (snippets text)
|
leftover = map (file: "${usageSnippets.dir}/${file}: no nix block for it, ${outdated}") (
|
||||||
);
|
lib.subtractLists (map (snippet: snippet.file) snippets) committed
|
||||||
|
);
|
||||||
|
|
||||||
# [text](target) and [text](target#anchor), except absolute URLs.
|
# [text](target) and [text](target#anchor), except absolute URLs.
|
||||||
links =
|
links =
|
||||||
@@ -162,11 +149,7 @@ in
|
|||||||
[ ]
|
[ ]
|
||||||
) (links (guideText name));
|
) (links (guideText name));
|
||||||
|
|
||||||
problems =
|
problems = leftover ++ lib.concatMap snippetProblems snippets ++ lib.concatMap linkProblems guides;
|
||||||
textProblems "README.md" readmeText
|
|
||||||
++ lib.concatMap (
|
|
||||||
name: textProblems "docs/usage/${name}" (guideText name) ++ linkProblems name
|
|
||||||
) guides;
|
|
||||||
in
|
in
|
||||||
pkgs.runCommand "proxy-suite-usage-docs-check" { } (
|
pkgs.runCommand "proxy-suite-usage-docs-check" { } (
|
||||||
if problems == [ ] then
|
if problems == [ ] then
|
||||||
@@ -178,14 +161,16 @@ in
|
|||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
# The tree as `nix fmt` leaves it.
|
# The tree as `nix fmt` leaves it; the generated usage snippets are left as written.
|
||||||
nix-format =
|
nix-format =
|
||||||
pkgs.runCommand "proxy-suite-nix-format-check" { nativeBuildInputs = [ pkgs.nixfmt ]; }
|
pkgs.runCommand "proxy-suite-nix-format-check" { nativeBuildInputs = [ pkgs.nixfmt ]; }
|
||||||
''
|
''
|
||||||
cd ${
|
cd ${
|
||||||
pkgs.lib.fileset.toSource {
|
pkgs.lib.fileset.toSource {
|
||||||
root = ../..;
|
root = ../..;
|
||||||
fileset = pkgs.lib.fileset.fileFilter (file: file.hasExt "nix") ../..;
|
fileset = pkgs.lib.fileset.difference (pkgs.lib.fileset.fileFilter (
|
||||||
|
file: file.hasExt "nix"
|
||||||
|
) ../..) (pkgs.lib.fileset.maybeMissing ../../docs/usage/.snippets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
find . -name '*.nix' -print0 | xargs -0 nixfmt --check
|
find . -name '*.nix' -print0 | xargs -0 nixfmt --check
|
||||||
|
|||||||
+12
-5
@@ -17,8 +17,14 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pretty = text: {
|
||||||
|
__pretty = _: text;
|
||||||
|
val = null;
|
||||||
|
};
|
||||||
|
|
||||||
# Visible options only (renamed aliases are hidden, and so are groups left
|
# Visible options only (renamed aliases are hidden, and so are groups left
|
||||||
# with nothing but aliases), packages shown by name.
|
# with nothing but aliases). A defaultText is shown as written, Markdown ones
|
||||||
|
# as a ‹placeholder›; other packages by name.
|
||||||
visibleConfig =
|
visibleConfig =
|
||||||
opts: cfg:
|
opts: cfg:
|
||||||
lib.filterAttrs (name: value: lib.isOption opts.${name} || value != { }) (
|
lib.filterAttrs (name: value: lib.isOption opts.${name} || value != { }) (
|
||||||
@@ -26,11 +32,12 @@ let
|
|||||||
name: opt:
|
name: opt:
|
||||||
if !lib.isOption opt then
|
if !lib.isOption opt then
|
||||||
visibleConfig opt cfg.${name}
|
visibleConfig opt cfg.${name}
|
||||||
|
else if (opt.defaultText._type or null) == "literalExpression" then
|
||||||
|
pretty opt.defaultText.text
|
||||||
|
else if (opt.defaultText._type or null) == "literalMD" then
|
||||||
|
pretty "‹${lib.replaceStrings [ "`" ] [ "" ] opt.defaultText.text}›"
|
||||||
else if lib.isDerivation cfg.${name} then
|
else if lib.isDerivation cfg.${name} then
|
||||||
{
|
pretty "pkgs.${lib.getName cfg.${name}}"
|
||||||
__pretty = _: "pkgs.${lib.getName cfg.${name}}";
|
|
||||||
val = null;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
cfg.${name}
|
cfg.${name}
|
||||||
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts)
|
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts)
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# The ```nix blocks of the README and the usage guides that set services.proxy-suite, each
|
||||||
|
# as a whole module. update-docs writes them to docs/usage/.snippets, where the usage-docs
|
||||||
|
# check imports them: Nix only parses files, and `nix flake check --no-build` can't write
|
||||||
|
# one to the store. A block fenced ```nix no-check is skipped; one that starts with "{" is
|
||||||
|
# a module already, anything else is its attributes.
|
||||||
|
{ lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
usageDir = ../docs/usage;
|
||||||
|
markdownIn =
|
||||||
|
dir:
|
||||||
|
map (name: lib.removePrefix "./" "${dir}/${name}") (
|
||||||
|
builtins.filter (lib.hasSuffix ".md") (builtins.attrNames (builtins.readDir (usageDir + "/${dir}")))
|
||||||
|
);
|
||||||
|
guides = markdownIn "." ++ markdownIn "examples";
|
||||||
|
|
||||||
|
blocks =
|
||||||
|
text:
|
||||||
|
builtins.filter (lib.hasInfix "services.proxy-suite") (
|
||||||
|
map (chunk: builtins.head (lib.splitString "\n```" chunk)) (
|
||||||
|
builtins.tail (lib.splitString "```nix\n" text)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
module =
|
||||||
|
block:
|
||||||
|
if lib.hasPrefix "{" block then
|
||||||
|
block
|
||||||
|
else
|
||||||
|
''
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
${block}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
docs = [
|
||||||
|
{
|
||||||
|
where = "README.md";
|
||||||
|
stem = "README";
|
||||||
|
text = builtins.readFile ../README.md;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ map (name: {
|
||||||
|
where = "docs/usage/${name}";
|
||||||
|
stem = lib.replaceStrings [ "/" ] [ "-" ] (lib.removeSuffix ".md" name);
|
||||||
|
text = builtins.readFile (usageDir + "/${name}");
|
||||||
|
}) guides;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit guides;
|
||||||
|
dir = "docs/usage/.snippets";
|
||||||
|
# [ { file, where, text } ], file relative to dir.
|
||||||
|
snippets = lib.concatMap (
|
||||||
|
doc:
|
||||||
|
lib.imap1 (index: block: {
|
||||||
|
file = "${doc.stem}-${toString index}.nix";
|
||||||
|
where = "${doc.where}, nix block ${toString index}";
|
||||||
|
text = module block;
|
||||||
|
}) (blocks doc.text)
|
||||||
|
) docs;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user