about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/mautrix-googlechat/default.nix
blob: 41a72eec05956929e039b3b97eaae715c91a5647 (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
{ fetchFromGitHub
, fetchpatch
, lib
, python3
, enableE2be ? true
, enableMetrics ? true
, enableSqlite ? true
}: python3.pkgs.buildPythonApplication rec {
  pname = "mautrix-googlechat";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "mautrix";
    repo = "googlechat";
    rev = "refs/tags/v${version}";
    hash = "sha256-a/EWz/aCkBE6XdDpmZcx2Q7/xKNwGCiZUhZc9YIIDhU=";
  };

  patches = [
    (fetchpatch {
      # patch setup.py to generate $out/bin/mautrix-googlechat
      # https://github.com/mautrix/googlechat/pull/81
      name = "mautrix-googlechat-entry-point.patch";
      url = "https://github.com/mautrix/googlechat/pull/81/commits/112fa3d27bc6f89a02321cb80d219de149e00df8.patch";
      sha256 = "sha256-DsITDNLsIgBIqN6sD5JHaFW0LToxVUTzWc7mE2L09IQ=";
    })
  ];

  baseConfigPath = "share/mautrix-googlechat/example-config.yaml";
  postInstall = ''
    rm $out/example-config.yaml
    install -D mautrix_googlechat/example-config.yaml $out/$baseConfigPath
  '';

  passthru.optional-dependencies = with python3.pkgs; {
    e2be = [
      python-olm
      pycryptodome
      unpaddedbase64
    ];
    metrics = [
      prometheus-client
    ];
    sqlite = [
      aiosqlite
    ];
  };

  propagatedBuildInputs = with python3.pkgs; [
    aiohttp
    commonmark
    yarl
    asyncpg
    ruamel-yaml
    commonmark
    python-magic
    protobuf
    mautrix
  ] ++ lib.optionals enableE2be passthru.optional-dependencies.e2be
  ++ lib.optionals enableMetrics passthru.optional-dependencies.metrics
  ++ lib.optionals enableSqlite passthru.optional-dependencies.sqlite;

  doCheck = false;

  meta = with lib; {
    homepage = "https://github.com/mautrix/googlechat";
    description = "A Matrix-Google Chat puppeting bridge";
    license = licenses.agpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ arcnmx ];
  };
}