{ config, pkgs, lib, ... }:
let
  tor-browser = pkgs.writeShellScriptBin "tor-browser" ''
    mullvad-exclude ${pkgs.tor-browser-bundle-bin}/bin/tor-browser
  '';
in {
  home-manager.users.${config.mainuser}.home.packages = if config.deviceSpecific.vpn.mullvad.enable then [
    tor-browser
  ] else [
    pkgs.tor-browser-bundle-bin
  ];

  persist.state.homeDirectories = [ ".local/share/tor-browser" ];
}