{ lib, config, ... }: let defaultTrue = lib.mkDefault true; defaultEnableTorProxy = { tor.proxy = defaultTrue; tor.enforce = defaultTrue; }; defaultEnforceTor = { tor.enforce = defaultTrue; }; in { services.tor = { enable = true; client.enable = true; }; services = { # Use Tor as a proxy for outgoing connections # and restrict all connections to Tor # bitcoind = defaultEnableTorProxy; lnd = defaultEnableTorProxy; mempool = defaultEnableTorProxy; # These services don't make outgoing connections # but we restrict them to Tor just to be safe. # electrs = defaultEnforceTor; }; # Add onion services for incoming connections nix-bitcoin.onionServices = { bitcoind.enable = defaultTrue; electrs.enable = defaultTrue; }; }