summary refs log tree commit diff
path: root/services/irc/soju.nix
blob: e5c55c19f16b763af7c2a68441c4172d20a4570f (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
{ me, pkgs, auxiliaryPkgs, ... }:

let
  inherit (pkgs) dockerTools soju;
  inherit (auxiliaryPkgs) common;

  ircPort = 6667;
  socketPort = 3030;
  sojuDir = "/srv/soju";

  sojuImage = dockerTools.streamLayeredImage {
    name = soju.pname;
    tag = soju.version;
    fromImage = common.alpine.base;

    contents = [ soju ];

    extraCommands = ''
      mkdir -p ./run/soju
    '';
  };

in
{
  foundation.services.soju = {
    image = sojuImage;
    ports = [
      (common.tailnetPort me ircPort)
      (common.tailnetPort me socketPort)
    ];

    volumes = [
      [ "${sojuDir}/config.in" "/etc/soju/config.in" ]
      [ "${sojuDir}/soju.db" "/var/lib/soju/soju.db" ]
      [ "${sojuDir}/logs" "/var/lib/soju/logs" ]
    ];

    entrypoint = "${soju}/bin/soju";
    cmd = [ "-config" "/etc/soju/config.in" ];
  };
}