summaryrefslogtreecommitdiff
path: root/os/srv/i2p.nix
blob: f2c27b1d05c87f639f21101bb8f4aaa21d00942f (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  config,
  lib,
  pkgs,
  username,
  ...
}:
let
  cfg = config.os.srv.i2p;
in
{
  options.os.srv.i2p = {
    enable = lib.mkEnableOption "enables i2pd";
    enableBrowser = lib.mkEnableOption "enables mullvad browser and creates a desktop entry";
  };

  config = lib.mkMerge [
    (lib.mkIf cfg.enable {
      services.i2pd = {
        enable = true;
        bandwidth = 1024;
        logLevel = "info";
        upnp.enable = true;
        proto = {
          i2pControl.enable = true;
          http.enable = true;
          httpProxy.enable = true;
          socksProxy = {
            enable = true;
            outproxyEnable = true;
          };
          sam.enable = true;
        };
        yggdrasil = {
          enable = true;
          # address = "";
        };
        ssu2 = {
          enable = true;
          # published = true;
        };
      };
    })
    (lib.mkIf cfg.enableBrowser {
      home-manager.users.${username} = {
        home.packages = [ pkgs.mullvad-browser ];
        xdg.desktopEntries = {
          i2p-browser = {
            name = "i2p Browser";
            genericName = "Web Browser";
            exec = "${pkgs.mullvad-browser}/bin/mullvad-browser -p i2p";
          };
        };
      };
    })
  ];
}