anchor.diff:          exec = "${tor}/bin/tor -f ${pkgs.writeText "torrc" cfg.config}";
         };
   
  -    jobs.torPrivoxy = mkIf (cfg.enablePrivoxy && cfg.enableClient)
  +    jobs.torPrivoxy = mkIf (cfg.client.privoxy.enable && cfg.client.enable)
         { name = "tor-privoxy";
   
           startOn = "starting tor";
  
positive.code:         debug   8192 # Errors - *we highly recommended enabling this*
          
          user-manual ${privoxy}/doc/privoxy/user-manual
          listen-address  ${cfg.privoxyListenAddress}
          toggle  1
          enable-remote-toggle 0
          enable-edit-actions 0
  
negative.code:             # Needed to run privoxy as an unprivileged user?
              ${modprobe}/sbin/modprobe capability || true
            '';
          exec = "${privoxy}/sbin/privoxy --no-daemon --user ${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
        };
  
        services.tor.config = ''
          DataDirectory ${stateDir}
          User ${torUser}
        ''
        + optionalString cfg.client.enable  ''
          SocksListenAddress ${cfg.client.socksListenAddress}
          ${opt "SocksPolicy" cfg.client.socksPolicy}
        ''
        + optionalString cfg.relay.enable ''
          ORPort ${toString cfg.relay.port}
          ${opt "ORListenAddress" cfg.relay.listenAddress }
          ${opt "Nickname" cfg.relay.nickname}
          ${optint "RelayBandwidthRate" cfg.relay.bandwidthRate}
          ${optint "RelayBandwidthBurst" cfg.relay.bandwidthBurst}
          ${if cfg.relay.isExit then opt "ExitPolicy" cfg.relay.exitPolicy else "ExitPolicy reject *:*"}
          ${if cfg.relay.isBridge then "BridgeRelay 1" else ""}
        '';
      
        services.tor.client.privoxy.config = ''
          # Generally, this file goes in /etc/privoxy/config
          #
          # Tor listens as a SOCKS4a proxy here:
          forward-socks4a / ${cfg.client.socksListenAddress} .
          confdir ${privoxy}/etc
          logdir ${privoxyDir}
          # actionsfile standard  # Internal purpose, recommended
  