{ config, pkgs, lib, ... }: let cfg = config.homeModules.tor; in lib.mkIf cfg.enable { home.packages = with pkgs; [ tor-browser-bundle-bin onionshare qbittorrent torsocks qbittorrent ]; systemd.user.services.tor-browser = { Unit = { Description = "Launch Tor Browser"; }; Service = { ExecStart = "${pkgs.tor-browser-bundle-bin}/bin/tor-browser"; Restart = "always"; }; Install = { WantedBy = [ "default.target" ]; }; }; # Optionally allow torsocks usage system-wide #environment.variables = { # This allows tools to use torsocks if invoked manually # You may prefer wrapping apps instead # TOR_SOCKS_PORT = "9050"; #}; # Optional CLI wrapper for routing traffic through Tor home.shellAliases = { torify = "torsocks"; }; }