nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchFromGitHub,
3 fetchpatch,
4 lib,
5 python3,
6 enableE2be ? true,
7 enableMetrics ? true,
8 enableSqlite ? true,
9}:
10python3.pkgs.buildPythonApplication rec {
11 pname = "mautrix-googlechat";
12 version = "0.5.2";
13 format = "setuptools";
14
15 src = fetchFromGitHub {
16 owner = "mautrix";
17 repo = "googlechat";
18 tag = "v${version}";
19 hash = "sha256-4H+zUH0GEQ5e/9Bv0BVdf1/pXulx2ihZrhJ+jl/db+U=";
20 };
21
22 patches = [
23 (fetchpatch {
24 # patch setup.py to generate $out/bin/mautrix-googlechat
25 # https://github.com/mautrix/googlechat/pull/81
26 name = "mautrix-googlechat-entry-point.patch";
27 url = "https://github.com/mautrix/googlechat/pull/81/commits/112fa3d27bc6f89a02321cb80d219de149e00df8.patch";
28 sha256 = "sha256-DsITDNLsIgBIqN6sD5JHaFW0LToxVUTzWc7mE2L09IQ=";
29 })
30 ];
31
32 baseConfigPath = "share/mautrix-googlechat/example-config.yaml";
33 postInstall = ''
34 rm $out/example-config.yaml
35 install -D mautrix_googlechat/example-config.yaml $out/$baseConfigPath
36 '';
37
38 optional-dependencies = with python3.pkgs; {
39 e2be = [
40 python-olm
41 pycryptodome
42 unpaddedbase64
43 ];
44 metrics = [
45 prometheus-client
46 ];
47 sqlite = [
48 aiosqlite
49 ];
50 };
51
52 propagatedBuildInputs =
53 with python3.pkgs;
54 [
55 aiohttp
56 commonmark
57 yarl
58 asyncpg
59 ruamel-yaml
60 commonmark
61 python-magic
62 protobuf
63 (mautrix.override { withOlm = enableE2be; })
64 ]
65 ++ lib.optionals enableE2be optional-dependencies.e2be
66 ++ lib.optionals enableMetrics optional-dependencies.metrics
67 ++ lib.optionals enableSqlite optional-dependencies.sqlite;
68
69 doCheck = false;
70
71 meta = {
72 homepage = "https://github.com/mautrix/googlechat";
73 description = "Matrix-Google Chat puppeting bridge";
74 license = lib.licenses.agpl3Plus;
75 platforms = lib.platforms.linux;
76 maintainers = with lib.maintainers; [ arcnmx ];
77 mainProgram = "mautrix-googlechat";
78 };
79}