@@ -1,69 +0,0 @@
1−{ config, lib, pkgs, ... }:
2−with lib;
3−let
4−
5− cfg = config.services.tor;
6−
7− torify = pkgs.writeTextFile {
8− name = "torify";
9− text = ''
10− #!${pkgs.stdenv.shell}
11− TSOCKS_CONF_FILE=${pkgs.writeText "tsocks.conf" cfg.torify.config} LD_PRELOAD="${pkgs.tsocks}/lib/libtsocks.so $LD_PRELOAD" "$@"
12− '';
13− executable = true;
14− destination = "/bin/torify";
15− };
16−
17−in
18−
19−{
20−
21− ###### interface
22−
23− options = {
24−
25− services.tor.torify = {
26−
27− enable = mkOption {
28− default = cfg.client.enable;
29− description = ''
30− Whether to build torify scipt to relay application traffic via TOR.
31− '';
32− };
33−
34− server = mkOption {
35− default = "localhost:9050";
36− example = "192.168.0.20";
37− description = ''
38− IP address of TOR client to use.
39− '';
40− };
41−
42− config = mkOption {
43− default = "";
44− description = ''
45− Extra configuration. Contents will be added verbatim to TSocks
46− configuration file.
47− '';
48− };
49−
50− };
51−
52− };
53−
54− ###### implementation
55−
56− config = mkIf cfg.torify.enable {
57−
58− environment.systemPackages = [ torify ]; # expose it to the users
59−
60− services.tor.torify.config = ''
61− server = ${toString(head (splitString ":" cfg.torify.server))}
62− server_port = ${toString(tail (splitString ":" cfg.torify.server))}
63−
64− local = 127.0.0.0/255.128.0.0
65− local = 127.128.0.0/255.192.0.0
66− '';
67− };
68−
69−}