summaryrefslogtreecommitdiffstats
path: root/jeschli/2configs/IM.nix
blob: 288134fa2f34677a0fad84833152131b35fd4b8a (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
with (import <stockholm/lib>);
{ config, lib, pkgs, ... }:
let
  tmux = pkgs.writeDashBin "tmux" ''
    export TERM=xterm-256color
    exec ${pkgs.tmux}/bin/tmux -f ${pkgs.writeText "tmux.conf" ''
      set-option -g default-terminal screen-256color
    ''} "$@"
  '';
in {

  services.bitlbee = {
    enable = true;
    portNumber = 6666;
    plugins = [
      pkgs.bitlbee-facebook
      pkgs.bitlbee-steam
      pkgs.bitlbee-discord
    ];
    libpurple_plugins = [ pkgs.telegram-purple ];
  };

  users.extraUsers.chat = {
    home = "/home/chat";
    uid = genid "chat";
    useDefaultShell = true;
    createHome = true;
    openssh.authorizedKeys.keys = with config.krebs.users; [
      jeschli.pubkey
      jeschli-bln.pubkey
      jeschli-brauerei.pubkey
    ];
    packages = [ tmux ];
  };


  systemd.services.chat = {
    description = "chat environment setup";
    after = [ "network.target" ];
    wantedBy = [ "multi-user.target" ];

    restartIfChanged = false;

    path = [
      pkgs.rxvt_unicode.terminfo
    ];

    serviceConfig = {
      User = "chat";
      RemainAfterExit = true;
      Type = "oneshot";
      ExecStart = "${tmux}/bin/tmux -2 new-session -d -s IM ${pkgs.weechat}/bin/weechat";
      ExecStop = "${tmux}/bin/tmux kill-session -t IM";
    };
  };
}