services: use new 'tor' options

This commit is contained in:
Erik Arvstedt
2021-08-05 00:49:00 +02:00
parent e44f78ebb8
commit 178a0dcf8f
18 changed files with 56 additions and 39 deletions

View File

@@ -49,13 +49,19 @@ with lib;
default = import ../pkgs/lib.nix lib pkgs;
};
torClientAddressWithPort = mkOption {
readOnly = true;
default = with config.services.tor.client.socksListenAddress;
"${addr}:${toString port}";
};
# Torify binary that works with custom Tor SOCKS addresses
# Related issue: https://github.com/NixOS/nixpkgs/issues/94236
torify = mkOption {
readOnly = true;
default = pkgs.writeScriptBin "torify" ''
${pkgs.tor}/bin/torify \
--address ${head (splitString ":" config.services.tor.client.socksListenAddress)} \
--address ${config.services.tor.client.socksListenAddress.addr} \
"$@"
'';
};