aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/irc.nix
blob: 6500ca5893b6a8dfd20e4c77099dc9c739fd8bbf (plain) (blame)
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
{ lib, pkgs, config, myconfig, mylibs, ... }:
{
  options = {
    services.irc.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Whether to enable irc stuff.
      '';
    };
  };

  config = lib.mkIf config.services.irc.enable {
    security.acme.certs."irc" = config.services.myCertificates.certConfig // {
      domain = "irc.immae.eu";
      postRun = ''
        systemctl restart stunnel.service
      '';
    };

    networking.firewall.allowedTCPPorts = [ 6697 ];
    services.bitlbee = {
      enable = true;
      authMode = "Registered";
      libpurple_plugins = [
        pkgs.purple-hangouts
        pkgs.purple-matrix
      ];
      plugins = [
        pkgs.bitlbee-mastodon
        pkgs.bitlbee-facebook
        pkgs.bitlbee-discord
        pkgs.bitlbee-steam
      ];
    };

    services.stunnel = {
      enable = true;
      servers = {
        bitlbee = {
          accept = 6697;
          connect = 6667;
          cert = "/var/lib/acme/irc/full.pem";
        };
      };
    };
  };
}