nixos-config/nixos/system/packages/tor.nix
2025-04-06 10:39:38 +02:00

56 lines
1.3 KiB
Nix

{
lib,
config,
...
}: {
options = {
program.tor.enable = lib.mkEnableOption "Enable Tor";
program.proxychains.enable = lib.mkEnableOption "Enable Proxychains";
};
config = lib.mkMerge [
(lib.mkIf config.program.tor.enable {
services.tor = {
enable = true;
# ** This block exposes your service to the tor network **
# ** Change the port and target to your service **
# ** Get the onion address from /var/lib/tor/[myOnion]/hostname **
#enableGeoIP = false;
#relay.onionServices = {
#myOnion = {
# version = 3;
# map = [
# {
# port = 80;
# target = {
# addr = "127.0.0.1";
# port = 3000;
# };
# }
# ];
#};
#};
#settings = {
# ClientUseIPv4 = true;
# ClientUseIPv6 = false;
# ClientPreferIPv6ORPort = false;
#};
};
})
(lib.mkIf config.program.proxychains.enable {
programs.proxychains = {
enable = true;
chain.type = "dynamic";
proxies = {
tor-proxy = {
enable = true;
type = "socks5";
host = "127.0.0.1";
port = 9050;
};
};
};
})
];
}