summaryrefslogtreecommitdiff
path: root/modules/tor.nix
blob: 8777fba5b5affe3b0025e2eee0fa5f5a2b2de285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.os.srv.tor;
in
{
  options.os.srv.tor = {
    enable = lib.mkEnableOption "enables tor services";
    enableBrowser = lib.mkEnableOption "enables the tor browser";
  };

  config = lib.mkMerge [
    (lib.mkIf cfg.enable {
      services.tor = {
        enable = true;
        client = {
          enable = true;
          dns.enable = true;
          transparentProxy.enable = true;
        };
      };
    })
    (lib.mkIf cfg.enableBrowser {
      environment.systemPackages = [ pkgs.tor-browser ];
    })
  ];
}