···
cfg = config.services.tor.torsocks;
optionalNullStr = b: v: optionalString (b != null) v;
10
-
TorAddress ${toString (head (splitString ":" cfg.server))}
11
-
TorPort ${toString (tail (splitString ":" cfg.server))}
9
+
configFile = server: ''
10
+
TorAddress ${toString (head (splitString ":" server))}
11
+
TorPort ${toString (tail (splitString ":" server))}
OnionAddrRange ${cfg.onionAddrRange}
···
AllowInbound ${if cfg.allowInbound then "1" else "0"}
23
+
wrapTorsocks = name: server: pkgs.writeTextFile {
26
+
#!${pkgs.stdenv.shell}
27
+
TORSOCKS_CONF_FILE=${pkgs.writeText "torsocks.conf" (configFile server)} ${pkgs.torsocks}/bin/torsocks "$@"
30
+
destination = "/bin/${name}";
···
IP/Port of the Tor SOCKS server. Currently, hostnames are
NOT supported by torsocks.
56
+
fasterServer = mkOption {
58
+
default = "127.0.0.1:9063";
59
+
example = "192.168.0.20:1234";
61
+
IP/Port of the Tor SOCKS server for torsocks-faster wrapper suitable for HTTP.
62
+
Currently, hostnames are NOT supported by torsocks.
···
config = mkIf cfg.enable {
92
-
environment.systemPackages = [ pkgs.torsocks ];
113
+
environment.systemPackages = [ pkgs.torsocks (wrapTorsocks "torsocks-faster" cfg.fasterServer) ];
95
-
[ { source = pkgs.writeText "torsocks.conf" configFile;
116
+
[ { source = pkgs.writeText "torsocks.conf" (configFile cfg.server);
target = "tor/torsocks.conf";