aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/irc.nix
blob: c48a4b3794bd87cbf5bb9e6171516e7b8b8b9eb8 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ lib, pkgs, config, ... }:
let
  cfg = config.myServices.irc;
in
{
  options.myServices = {
    irc.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Whether to enable irc stuff.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    myServices.dns.zones."immae.eu".subdomains.irc =
      with config.myServices.dns.helpers; ips servers.eldiron.ips.main;

    myServices.chatonsProperties.services.bitlbee = {
      file.datetime = "2022-08-27T19:00:00";
      service = {
        name = "Bitlbee";
        description = "An IRC to other chat networks gateway";
        logo = "https://www.bitlbee.org/style/logo.png";
        website = "irc.immae.eu";
        status.level = "OK";
        status.description = "OK";
        registration."" = ["MEMBER" "CLIENT"];
        registration.load = "FULL";
        install.type = "PACKAGE";
      };
      software = {
        name = "BitlBee";
        website = "https://www.bitlbee.org/";
        license.url = "https://github.com/bitlbee/bitlbee/blob/master/COPYING";
        license.name = "GNU General Public License v2.0";
        version = pkgs.bitlbee.version;
        source.url = "https://github.com/bitlbee/bitlbee";
        modules = map (a: a.pname) config.services.bitlbee.plugins
          ++ map (a: a.pname) config.services.bitlbee.libpurple_plugins;
      };
    };
    security.acme.certs."irc" = {
      domain = "irc.immae.eu";
      postRun = ''
        systemctl restart stunnel.service
      '';
    };

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

    services.stunnel = {
      enable = true;
      servers = {
        bitlbee = {
          accept = 6697;
          connect = 6667;
          cert = "${config.security.acme.certs.irc.directory}/full.pem";
        };
      };
    };
  };
}